#!/usr/local/bin/perl

$thecount = 0;
$line = <STDIN>;
while ($line ne "") {
        chop ($line);
        @words = split(/ /, $line);
        $wordindex = 1;
        while ($wordindex <= @words) {
                if ($words[$wordindex-1] eq "the") {
                        $thecount += 1;
                }
                $wordindex++;
        }
        $line = <STDIN>;
}
print ("Total occurrences of \"the\": $thecount\n");
