Assignment #5: Anagrams

Find large sets of words that are anagrams for each other. Two words are anagrams if they contain the same set of letters (with same frequencies). For instance, least and steal are anagrams. So are steal and stale. In fact, least, steal, tales, stale, and slate are anagrams of each other, and form a large group of anagrams. You must find all large groups (five or more words) of anagrams contained in a dictionary that I will provide.


java.util classes.


For each word, compute its representative. The representative is the characters of the word in sorted order. For instance, the representative for the word enraged is adeegnr. Observe that words that are anagrams will have the same representative. Thus the representative for grenade is also adeegnr. You will use a Map in which the key is a String that is a representative, and the value is a List of all words that have the key as their representative. After constructing the Map, you simply need to find all values whose Lists have size five or higher and print those Lists.