# Group Anagram An alternative, grouping a list of words into anagrams. Idea is similar to [[anagram]], use sorted word as the key. ```python anagram_map = defaultdict(list) for word in words: sorted_word = "".join(sorted(word)) anagram_map[sorted_word].append(word) return anagram_map.values() ``` Alternatively, create a signature manually. e.g. ```python a = ord('a') count = [0] * 26 for c in word: count[ord(c) - a] += 1 result = [] for i, n in enumerate(count): if n: result.extend([chr(i + a), str(n)]) return "".join(result) ``` Alternatively