anagram check algorithm