num = gets.chomp.split num.map!{|n| n.to_i} for i in 0..9 if num[0] != 1 puts 1 elsif i == 9 break elsif num [i] + 1 != num[i + 1] puts num[i] + 1 end end