import System.IO import Control.Monad (when) import Text.Printf main :: IO () main = do hSetBuffering stdout NoBuffering solve 0 solve :: Int -> IO () solve n = do printf "%03d\n" n a <- getLine when (a == "locked") (solve (n + 1))