An n^2 anagram algorithm