Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (17 sloc) 650 Bytes
#!/usr/bin/env runhaskell
import Control.Arrow
import System.IO
import Data.Char
import Data.List
import System.Environment
main = do
ls <- fmap lines $ hGetContents stdin
length ls `seq` return ()
let go :: String -> (Int, [String]) -> (Int, [String])
go line (col, result)
| thiscol == 0 ||
not ("Step" `isPrefixOf` rest) = (col, result)
| thiscol < col = (thiscol, line : result)
| otherwise = (col, result)
where (thiscol, rest) = first length $ span isSpace line
putStr $ unlines $ snd $ foldr go (maxBound, []) ls