Medium
Three Most Common Words
Read n lines and write them to
data.txt. Read the file and print the 3 most common words (lower case) as word count, most common first and ties in alphabetical order. Print fewer if there are fewer words.Input
n, then n lines.
Output
Up to 3 lines.
Sample 1
Input
2 the cat and the dog The end
Output
the 3 and 1 cat 1
Sample 2
Input
1 hello
Output
hello 1
Output appears here