module Main where
-- import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
-- import qualified Data.Map as M
import Data.Ord
import Control.Applicative
import Control.Monad

solve :: [(Int, Slope)] -> [Int]
solve = iter [] [] where
    iter _ lakes [] = map snd (reverse lakes)
    iter [] lakes ((_, Rising):ls) = iter [] lakes ls -- skip
    iter indexes lakes ((_, Flat):ls) = iter indexes lakes ls -- skip
    iter indexes lakes ((j, GoingDown):ls) = iter (j:indexes) lakes ls
    iter (i:indexes) lakes ((j, Rising):ls) = iter indexes (updateLakes i j lakes) ls

    updateLakes i j [] = [(i, j-i)]
    updateLakes i j lakes = (i, j-i + sumArea):others where
        (toUnite, others) = span (\(k, _) -> i < k) lakes
        sumArea = sum (map snd toUnite)

data Slope = Rising | Flat | GoingDown deriving (Eq, Show)

toList :: B.ByteString -> [(Int, Slope)]
toList = iter 0 where
    iter i s = if B.null s
                    then []
                    else (case B.head s of
                            '/'  -> (i,  Rising)
                            '_'  -> (i,  Flat)
                            '\\' -> (i,  GoingDown)):iter (i+1) (B.tail s)

print' :: [Int] -> IO ()
print' []  = putStrLn ""
print' [x] = putStrLn $ show x
print' (x:xs) = do
    putStr (show x++" ")
    print' xs

main :: IO() 
main = do
    slopes <- B.getLine
    let sl = toList slopes
        l = solve sl 
    print (sum l)
    print' $ (length l):l

