Write anagram checker in terms of frequency