I need to make a program that counts the number of words in a string. I also need to count the number of times a word appears and then sort the array based on that number. I've got it to count the total words and how many times each one appears but it shows the word multiple times in the output instead of just once. Any ideas on how to do something like this?