~/algor $ cat problems/string-eng-kop-uchragan-soz
Most frequent word
Medium
1000 ms
128 MB
49%
A text $s$ of lowercase Latin letters and spaces is given. Find the word that occurs in the text most often and how many times it occurs. If several words are tied, take the one that comes first in dictionary order. Words are separated by a single space.
Input
One line containing the string $s$.
Output
One line with the word and the number of its occurrences separated by a space.
Note
$1 \le |s| \le 10^{5}$
$s$ consists of lowercase Latin letters and spaces
$s$ does not start or end with a space, and words are separated by exactly one space
Examples
Input #1
olma anor olma nok anor olma
Output #1
olma 3
Input #2
nok uzum
Output #2
nok 1