#K81627. Most Frequent Word

    ID: 35796 Type: Default 1000ms 256MiB

Most Frequent Word

Most Frequent Word

Given a string of space-separated words, find the most frequently occurring word. In case of a tie, return the word that appears first in lexicographical order. Formally, if the frequency of words is represented by \(f(word)\), then the answer is the word \(w\) such that:

\[ f(w) = \max_{word \in S} f(word) \]

and if there are multiple words with the same frequency, choose the one with the smallest lexicographical order.

For example, for the input apple banana apple orange banana, both "apple" and "banana" appear twice; however, "apple" is lexicographically smaller than "banana", so the correct output is apple.

inputFormat

The input consists of a single line containing a list of space-separated words.

outputFormat

Output a single word which is the most frequent. In the case of a tie in frequency, output the lexicographically smallest word.

## sample
apple
apple