[your code here]

Joshua Niehus jm.niehus at gmail.com
Sat Jan 28 22:12:39 PST 2012


> 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.


More information about the Digitalmars-d mailing list