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