while ( $line = <> ){
    @words = split(/\b/, $line);
    foreach $w ( @words ){
	if ( $w =~ /^m.*s$/ ){
	    print $w, "\n";
	}
    }
}
