Without using a
map < string, int >
this problem is really hard.
This should only run ~40 lines of code in two phases: read the input / count up the word frequencies, print out the results.
The input is not going to be sorted like the example.