Two approaches for the key:
Sorted string: sort the characters. "eat", "tea", "ate" all become "aet".
Character count: represent as a tuple of 26 counts. "eat" becomes (1,0,0,0,1,0,...,1,0,0). Sorted string is simpler to implement. Character count is faster for long strings ( vs ). Both create a canonical form that's identical for all anagrams.