Java Program – to find a frequency of words.

Output: