def iter a ns = [] for i in 0 ... 10 b = a + i.to_s b = b + '0' while b.length < 10 puts b STDOUT.flush n, res = gets.chomp.split ns[i] = n.to_i if res == 'unlocked' exit(0) end end mx = ns[0] idx = 0 for i in 0 ... 10 if mx < ns[i] mx = ns[i] idx = i end end iter (a + idx.to_s) end iter ''