Counting the frequencies of words are a basic and important task in natural language processing. In this problem, you will be given a text, and you have to print the word that has occurred the most number of times in that text.
The input contain at most 100 lines. Each of these lines will have at most 100 words each. Each word will consist of only alphabets. Each word will have at most 20 characters each. A line will only have words and spaces.
For each dataset, output the word that has appeared the most number of times in the dataset. It is guaranteed that only one word will have the most number of occurrences in a dataset.
big league little league big and little league
You will have to read the input until the end of file (EOF).
Login to submit
Using a map data structure: As you read each word from the input, use a map data structure to keep a...