The three most common words
Task
The file text.txt contains text (words separated by spaces and line endings, no punctuation). The program counts how many times each word occurs - ignoring upper and lower case - and prints the three most common words in lower case as word: count, from the most common. On equal counts alphabetical order decides. If there are fewer than three different words, it prints all of them.
For the file
the program prints:
Examples
Input
(no input)
Expected output
pes: 4 macka: 2 vlk: 1
After you submit, 5 hidden tests will also check your solution: equal counts, one word, an empty file, the fourth word drops out, upper and lower case.
You need to know
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.