import Control.Monad (when)


main :: IO ()
main = do
    cs <- fmap (zip [1..]) getLine :: IO [(Int, Char)]
    let as    = map fst . filter (\c -> snd c == '\\') $ cs
        bs    = map fst . filter (\c -> snd c == '/' ) $ cs
        areas = solve as bs []
    print $ sum areas
    putStr . show $ length areas
    when (areas /= []) $ putStr " "
    putStrLn $ unwords . map show . reverse $ areas


solve :: [Int] -> [Int] -> [(Int, Int)] -> [Int]
solve as []     areas = map snd areas
solve as (b:bs) areas =
    case getDown as b of
        Nothing ->
            solve as  bs areas
        Just a  ->
            solve as' bs (step areas')
          where
            as'    = [ x | x <- as, a /= x ]
            areas' = (a, b - a) : areas


getDown :: [Int] -> Int -> Maybe Int
getDown as b =
    case takeWhile (<b) as of
        [] ->
            Nothing
        cs ->
            Just (last cs)


step :: [(Int, Int)] -> [(Int, Int)]
step areas@((x, xa):(y, ya):rest)
    | y < x     = areas
    | otherwise = step $ (x, xa + ya) : rest
step areas = areas

