40 lines
922 B
Plaintext
40 lines
922 B
Plaintext
on mouseUp
|
|
put mostCommonAnagrams(url "http://wiki.puzzlers.org/pub/wordlists/unixdict.txt")
|
|
end mouseUp
|
|
|
|
function mostCommonAnagrams X
|
|
put 0 into maxCount
|
|
repeat for each word W in X
|
|
get sortChars(W)
|
|
put W & comma after A[it]
|
|
add 1 to C[it]
|
|
if C[it] >= maxCount then
|
|
if C[it] > maxCount then
|
|
put C[it] into maxCount
|
|
put char 1 to -2 of A[it] into winnerList
|
|
else
|
|
put cr & char 1 to -2 of A[it] after winnerList
|
|
end if
|
|
end if
|
|
end repeat
|
|
return winnerList
|
|
end mostCommonAnagrams
|
|
|
|
function sortChars X
|
|
get charsToItems(X)
|
|
sort items of it
|
|
return itemsToChars(it)
|
|
end sortChars
|
|
|
|
function charsToItems X
|
|
repeat for each char C in X
|
|
put C & comma after R
|
|
end repeat
|
|
return char 1 to -2 of R
|
|
end charsToItems
|
|
|
|
function itemsToChars X
|
|
replace comma with empty in X
|
|
return X
|
|
end itemsToChars
|