mozy contest: problem 4 PHP solution

Nicholas Leippe nick at leippe.com
Mon Nov 6 10:03:30 MST 2006


The fourth problem was simply equivalent to:

cat 'input file' | grep '^.*m.*o.*z.*y.*$' | wc -l

<?

$m = 0;
while ($line = fgets(STDIN)) {
        if (preg_match("/^.*m.*o.*z.*y.*$/", $line)) {
                $m++;
        }
}
echo "$m\n";




More information about the PLUG mailing list