Implementation of anagrams.