Mediumhashstrings
Most Frequent Word
Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0
Statement
One line contains words of lowercase Latin letters separated by spaces. Print the most frequent word and its number of occurrences separated by a space. If several words tie, print the lexicographically smallest one.
Examples
Example 1
Input
cat dog cat
Output
cat 2
Example 2
Input
a b b a
Output
a 2
Constraints
- Line length is between 1 and 10^5
- There is at least one word