Fast anagram solver in Ruby