a, b = gets.split.map(&:to_i) (a..b).each do |i| str_i = i.to_s str_i = str_i =~ /3/ if i % 3 == 0 || str_i puts i end end