Anagrams: Difference between revisions

718 bytes added ,  15 years ago
no edit summary
(+ AutoHotkey)
No edit summary
Line 282:
[evil, levi, live, veil, vile]
[caret, carte, cater, crate, trace]
 
=={{header|Mathematica}}==
Download the dictionary, split the lines, split the word in characters and sort them. Now sort by those words, and find sequences of equal 'letter-hashes'. Return the longest sequences:
<lang Mathematica>
text={#,StringJoin@@Sort[Characters[#]]}&/@Import["http://www.puzzlers.org/pub/wordlists/unixdict.txt","Lines"];
text=SortBy[text,#[[2]]&];
splits=Split[text,#1[[2]]==#2[[2]]&][[All,All,1]];
maxlen=Max[Length/@splits];
Select[splits,Length[#]==maxlen&]
</lang>
gives back:
<lang Mathematica>
{{abel,able,bale,bela,elba},{caret,carte,cater,crate,trace},{angel,angle,galen,glean,lange},{alger,glare,lager,large,regal},{elan,lane,lean,lena,neal},{evil,levi,live,veil,vile}}
</lang>
 
=={{header|Perl}}==
1,111

edits