RosettaCodeData/Task/Anagrams/Component-Pascal/anagrams-2.component

10 lines
359 B
Text
Raw Permalink Normal View History

2014-01-17 05:32:22 +00:00
import std.stdio, std.algorithm, std.string, std.exception, std.file;
2013-10-27 22:24:23 +00:00
void main() {
2014-01-17 05:32:22 +00:00
string[][ubyte[]] an;
foreach (w; "unixdict.txt".readText.splitLines)
an[w.dup.representation.sort().release.assumeUnique] ~= w;
2013-10-27 22:24:23 +00:00
immutable m = an.byValue.map!q{ a.length }.reduce!max;
writefln("%(%s\n%)", an.byValue.filter!(ws => ws.length == m));
}