using a dictionary to store the word frequency calculation results; going from O(n^2) to O(n)\!