# use strict; # use warnings; sub isNabeatsu { my $n = shift; return ($n =~ /3/ || $n % 3 == 0); } chomp(my $S = <>); my ($A, $B) = split(/\s/, $S); foreach ($A .. $B) { print($_, "\n") if isNabeatsu($_); }