Code Golf: Anagram Detector
An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
For example, the word anagram itself can be rearranged into nag a ram, also the word binary into brainy and the word adobe into abode. Wikipedia
You will receive two strings returning true if the two arguments given are anagrams of each other.
As usual shortest solution wins.
Input
"Listen"
, "Silent"
Output
1
Note
- Both arguments are case insensitive, only a-z, A-Z, no special characters except whitespace
- The arguments could contain whitespace
- Use this code to check the result length
- You can also use this test case here
Rules
- The signature of the contest entry MUST be:
Class codeGolf.Anagram
{
ClassMethod Detector(a As %String, b As %String) As %Boolean
{
; your code here
}
}
- It is forbidden to modify class/signature, including but not limited to:
- Adding inheritance
- Setting default argument values
- Adding class elements (Parameters, Methods, Includes, etc).
- It is forbidden to refer to non-system code from your entry. For example, this is not a valid entry:
ClassMethod Detector(a As %String, b As %String) As %Boolean
{
q ##class(myPackage.myClass).test(a)
}
- The use of $ZWPACK and $ZWBPACK is also discouraged.