1000.times do |i| puts ("000" + i.to_s)[-3..-1] STDOUT.flush break if gets.chomp == "unlocked" end