#K38357. Most Frequent Words

    ID: 26180 Type: Default 1000ms 256MiB

Most Frequent Words

Most Frequent Words

Given a string of words separated by spaces, the goal is to find the word or words that appear most frequently. If there are several words with the highest frequency, output all of them in alphabetical order. More formally, if we define the frequency function \(f(w)\) for a word \(w\), you must output every word for which \(f(w)=\max_{w \in S}f(w)\), where \(S\) is the set of all words in the input.

inputFormat

The input consists of a single line containing words separated by spaces.

outputFormat

Output the most frequent word(s) in alphabetical order, separated by a single space.

## sample
john loves the book book book loves john loves loves the books
loves