Its a work scoping exercise. They'll get fixed by hand so probable matches is good.
The way to fail this one is to start writing an elaborate Java or C program to try to solve it. This is typical of the J-Heads. They'll write a whole Java program with custom string scanning and stuff.
Wrong tool for the job. Perl, Ruby, grep, whatever man.