Anagrams: Difference between revisions
Content deleted Content added
No edit summary |
added perl |
||
Line 241:
[evil, levi, live, veil, vile]
[caret, carte, cater, crate, trace]
=={{header|Perl}}==
<perl>use LWP::Simple;
use List::Util qw(max);
my @words = split(' ', get('http://www.puzzlers.org/pub/wordlists/unixdict.txt'));
my %anagram;
foreach my $word (@words) {
push @{ $anagram{join('', sort(split(//, $word)))} }, $word;
}
my $count = max(map {scalar @$_} values %anagram);
foreach my $ana (values %anagram) {
if (@$ana >= $count) {
print "@$ana\n";
}
}</perl>
Output:
alger glare lager large regal
abel able bale bela elba
evil levi live veil vile
angel angle galen glean lange
elan lane lean lena neal
caret carte cater crate trace
=={{header|Python}}==
|