Solve group anagrams problem