RosettaCodeData/Task/Ordered-words/D/ordered-words-3.d

8 lines
275 B
D
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
void main() {
import std.stdio, std.algorithm, std.range, std.file, std.string;
auto words = "unixdict.txt".readText.split.filter!isSorted;
immutable maxLen = words.map!q{a.length}.reduce!max;
writefln("%-(%s\n%)", words.filter!(w => w.length == maxLen));
}