import Data.List

type Area = (Int, Int)
type Diagram = [(Int, Char)]

toDiagram :: String -> Diagram
toDiagram = zip [1..]

calcAreas :: Diagram -> Diagram -> [(Area, Int)] -> [(Area, Int)]
calcAreas [] _ zs = zs
calcAreas ((i, c):xs) ys zs
  | c == '_'  = calcAreas xs ys zs
  | c == '\\' = calcAreas xs ((i, c):ys) zs
  | c == '/'  = let prevD = find (\y -> snd y == '\\') ys
                in case prevD of
                  Nothing -> calcAreas xs ys zs
                  Just d -> calcAreas xs (delete d ys) (addArea i d zs)

addArea :: Int -> (Int, Char) -> [(Area, Int)] -> [(Area, Int)]
addArea nEnd (nStart, c) xs = ((nStart, nEnd), nEnd - nStart):xs

summarizeAreas :: [(Area, Int)] -> [(Area, Int)]
summarizeAreas [] = []
summarizeAreas [x] = [x]
summarizeAreas (((s1, e1), v1):((s2, e2), v2):xs)
  | s1 < s2 && e1 > e2 = summarizeAreas (((s1, e1), v1 + v2):xs)
  | otherwise          = ((s1, e1), v1) : summarizeAreas (((s2, e2), v2):xs)

main = do
  input <- getLine
  let result = reverse $ map snd $
                 summarizeAreas $ calcAreas (toDiagram input) [] []
  print $ sum result
  putStrLn $ unwords $ map show ((length result):result)