while(<>) { print; } while (<>) { for (split) { s/m/y/g; print; } } while ($_ = <>) { for $_ (split / /, $_) { $_ =~ s/m/y/g; print $_; } }