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