import Debug.Trace

main :: IO ()
main = do
  ss <- getLine 
  let ans = solve $ zip [0..] ss
  print $ sum ans
  putStrLn $ unwords $ map show $ length ans : (reverse ans)


solve :: [(Int, Char)] -> [Int]
solve input = go [] [] input
  where
    go :: [(Int, Char)] -> [(Int, Int)]
      -> [(Int, Char)] -> [Int]
    go _ ns [] = map snd ns
    go [] ns (x:xs)
      | snd x == '\\' = go [x] ns xs
      | snd x == '/' = go [] ns xs
      | otherwise = go [] ns xs
    go stack@(s:ss) ns (x:xs)
      | snd x == '\\' = go (x:stack) ns xs
      | snd x == '/' = go ss next xs
      | otherwise = go stack ns xs
      where
        (hd, tl) = span (\(loc, _) -> loc >= fst s) ns
        miz = (fst s, sum (map snd hd) + (fst x - fst s))
        next = miz : tl