i = 0 loop do sprintf("%03d", 0) STDOUT.flush break if gets.chomp == "unlocked" i += 1 end