#C13253. Most Frequent Word

    ID: 42771 Type: Default 1000ms 256MiB

Most Frequent Word

Most Frequent Word

Given a string consisting of words separated by spaces, your task is to determine the most frequent word. In case multiple words have the highest frequency, output the lexicographically smallest one. For example, given the string \(\texttt{cat bat dog bat cat bat dog bat}\), the word \(\texttt{bat}\) is the most frequent.

Note: Words are compared based on standard lexicographical ordering. Input and output are handled via standard input (stdin) and standard output (stdout) respectively.

inputFormat

The input consists of a single line containing a sequence of words separated by spaces. The input is read from standard input (stdin).

outputFormat

Output a single word: the one that appears most frequently in the input. If there is a tie, output the lexicographically smallest word among those tied. The output should be sent to standard output (stdout).

## sample
apple
apple