2 // EXECUTE_ARGS: runnable/extra-files/alice30.txt
3 // EXTRA_FILES: extra-files/alice30.txt
8 int main (string[] args)
13 int[string] dictionary;
15 writefln(" lines words bytes file");
16 foreach (arg; args[1 .. args.length])
18 int w_cnt, l_cnt, c_cnt;
22 auto input = cast(string)std.file.read(arg);
28 if (c >= '0' && c <= '9')
31 else if (c >= 'a' && c <= 'z' ||
42 { auto word = input[wstart .. j];
50 { auto w = input[wstart .. input.length];
53 writefln("%8s%8s%8s %s", l_cnt, w_cnt, c_cnt, arg);
61 writefln("--------------------------------------\n%8s%8s%8s total",
62 l_total, w_total, c_total);
65 writefln("--------------------------------------");
67 foreach (word1; dictionary.keys)
69 writefln("%3s %s", dictionary[word1], word1);