main :: IO () main = interact f f :: String -> String f = (++ "\n") . show . maximum . c c :: String -> [Int] c "" = [] c ('…':xs) = (head (c xs) + 1):tail (c xs) c (x:xs) = 0:c xs