input = gets.chomp.split.map(&:to_i) (input[0]..input[1]).each do |v| p v if v % 3 == 0 || v.to_s.match(/3/) end