Optimization in anagram_groups at fun_with_strings