Word Count Problem


Problem Description

Write a method named minChanges that takes a vector of strings, representing words, and that prints the frequency of each word. The words should be printed in alphabetical order.


Solution

The solution should use a HashMap to store the words and their frequencies. Once the words have been processed, the entries in the HashMap should be dumped into a list, the list should be sorted alphabetically on the words, and the entries should be printed:

  1. WordCount
  2. WordComparator