291. The Most Common Word
Print the word that appears most often, and how many times, separated by a space.
If several words tie for most common, print the one that comes first alphabetically. That rule exists because iteration order over a hash map is not defined, so without it the answer would depend on which map implementation your language happens to use.
That is worth sitting with: a hash map gives you fast lookup and NO order at all. Any ordering the output needs must be arranged separately.
Constraints - `1 ≤ n ≤ 100000` - `1 ≤ word length ≤ 20` - Words are lowercase letters only.
Input
The first line contains an integer n.
Each of the next n lines contains one word of lowercase letters.
Output
Print the most common word and its count, separated by a space. Break ties alphabetically.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.