Solving Frequency of occurrences problem from http://code-warrior.herokuapp.com.