Bad implementation of anagram