Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Word Count

Limits 1s, 512 MB

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).



93% Solution Ratio

experimenterEarliest, Dec '16

whoisdidarFastest, 0.0s

oneoff.t4wic3KWxTLightest, 131 kB

bokaifShortest, 87B


Login to submit


Using a map data structure: As you read each word from the input, use a map data structure to keep a...

Toph uses cookies. By continuing you agree to our Cookie Policy.