STDIN.close (0..999).each{|i| puts '%03d'%i #STDOUT.flush #exit if gets.chomp=='unlocked' }