An anagram is a rearrangement of letters to form a new word: for example
"owns" is an anagram of
A word is not its own anagram: for example,
"stop" is not an anagram of
Given a target word and a set of candidate words, this exercise requests the anagram set: the subset of the candidates that are anagrams of the target.
The target and candidates are words of one or more ASCII alphabetic characters (
Lowercase and uppercase characters are equivalent: for example,
"PoTS" is an anagram of
StoP is not an anagram of
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
Words in the anagram set should have the same letter case as in the candidate set.
Given the target
"stone" and candidates
"Seton", the anagram set is
Sign up to Exercism to learn and master LFE with 31 exercises, and real human mentoring, all for free.