Refactor "anagram".