A simple solution is go through the words list, for each word, sort its characters and form a map key, then add the word to the key, in the end, go through the hash map and print out the values (which are lists of grouped anagrams).