s = '0000000000' tmp = 0 a = '' 10.times{|k| tmp = 0 0.upto(9){|i| s[9 - k] = i.to_s puts s STDOUT.flush x,judge = gets.chomp.split x = x.to_i if judge == 'unlocked' exit end if tmp < x tmp = x a = i.to_s end } s[9 - k] = a }