Time

18:01:53
22 May 2012
Version for print

The talking Galcian

   "Ur-a-a! Earned!" - Matroskin joyfully exclaimed, hearing the first words uttered Galchonkom.

E. Uspenskiy "Three of Prostokvashino"

prb1099

   As you all know, Galcian from the cartoon "Three from Prostokvashino" at the knock in the door always asks: "Who's there?". Statistics, like all mathematics, is a fine science, and it argues that Galcian can remember individual words and whole sentences, but only if the word was uttered at least N times, and the sentence - at least M times (N M).

   By the given text you must determine the number of words and sentences that Galcian remembered.


Specifications

   Input

   The first line contains two positive integers N and M (N, M100). The second line is the actual text. The text is written grammatically correctly.

   Output

   Two numbers, separated with spaces: the number of memorized words S, and the number of memorized sentences P.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 50% 11/22
Classes: Algorithms on strings

Example

Example input

2 3
Kto tam? It is Pechkin. Kto tam? My name is Fedor. Kto tam? Pechkin!

Example output

4 1


← Queen move! Problems Полезная площадь →