inputs = STDIN.readlines.map(&:chomp) a, b = inputs[0].split(/\s+/).map(&:to_i) (a..b).each do |i| puts i if i % 3 == 0 || i.to_s.include?('3') end