Two strings are considered anagrams if the characters of one string can be rearranged to form the second string. For instance, "cat" and "act" are anagrams because the letters of "cat" can be rearranged to spell "act". "cat" and "cat" are also anagrams of each other.
This file contains a line-separated list of strings. Let A be the number of strings in the file that are an anagram of another string in the file. What is A ?
Click here to open the file.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Here's a solution in Haskell...
Given a list of the strings, sort each string alphabetically, sort the whole list alphabetically, group equal strings together into a nested list, weed out the lists that only have one element (no anagrams), then flatten all the strings into a single list, and get the length of that list!