import std.stdio, std.stream, std.string, std.range, std.algorithm;void main() { int countPalindromes; auto infile = new BufferedFile("ukacd17.txt"); foreach (char[] line; infile) { if (line.walkLength(2) > 1) { line.toLowerInPlace; if (equal(line, retro(line))) countPalindromes++; } } writeln("palindromes found: ", countPalindromes); }
I ran this code on Mac OSX Lion using the "/usr/share/dict/words" file and got 235834 words out of 235886. I think something is wrong.