import scala.io.StdIn.readLine
class Stack[T](val stack: List[T]) {
    def push(e: T): Stack[T] = new Stack[T](e :: stack)
    def pop(): Stack[T] = stack match {
        case Nil => new Stack[T](Nil)
        case x :: xs => new Stack[T](xs)
    }
    def top(): Option[T] = stack match {
        case Nil => None
        case x :: xs => Option(x)
    }
    def isEmpty(): Boolean = top == None
}
object Stack {
    def apply[T]() = new Stack[T](Nil)
}
object Main {
    def main(args: Array[String]) {
        val input = readLine.split("").toList
        val ret = calcArea(input)
        println(ret.sum)
        println(ret.length + " " + ret.mkString(" "))
    }
    def calcArea(data: List[String]): List[Int] = {
        def findMaxIndex(list: List[(String, Int)], hight: Int, max: Int, index: Int): Int = list match {
            case Nil => index
            case x :: xs => x._1 match {
                case "_" => findMaxIndex(xs, hight, max, index)
                case "\\" => findMaxIndex(xs, hight - 1, max, index)
                case "/" => {
                    val h = hight + 1
                    if (h > max) findMaxIndex(xs, h, h, x._2)
                    else findMaxIndex(xs, h, max, index)
                }
            }
        }
        def splitMax(list: List[String], maxIndex: Int, first: List[String]): (List[String], List[String]) = list match {
            case x :: xs if maxIndex == 0 && x == "/"=> ((x :: first).reverse, xs)
            case x :: xs => splitMax(xs, maxIndex - 1, x :: first)
            case Nil => (first.reverse, Nil)
        }
        // ある高さにおける水たまり面積のリストを作成 
        def go(zip: List[(String, Int)], stack: Stack[Int], hight: Int, ret: List[(Int, Int)]): List[(Int, Int)] = zip match {
            case Nil => ret
            case (x @ (symbol, idx)) :: xs => symbol match {
                case "_" => go(xs, stack, hight, ret)
                case "\\" => go(xs, stack.push(idx), hight - 1, ret)
                case "/" => {
                    if (stack.isEmpty) {
                        go(xs, stack, hight + 1, ret)
                    } else {
                        val prevIdx = stack.top.get
                        go(xs, stack.pop(), hight + 1, (idx - stack.top.get, hight + 1) :: ret)
                    }
                }
            }
        }
        def sumArea(list: List[(Int, Int)], ret: List[(Int, Int)]): List[(Int, Int)] = list match {
            case Nil => ret
            case x :: xs if ret == Nil => sumArea(xs, x :: ret)
            case curr :: xs => ret match {
                case pre :: ys if curr._2 < pre._2 => sumArea(xs, (curr._1 + pre._1, pre._2) :: ys)
                case pre :: ys => sumArea(xs, curr :: ret)
            }
        }
        
        val maxIndex = findMaxIndex(data.zipWithIndex, 0, 0, 0)
        val (first, last) = splitMax(data, maxIndex, Nil)
        val firstAreaList = go(first.zipWithIndex, Stack[Int](), 0, Nil)
        val lastAreaList = go(last.zipWithIndex, Stack[Int](), 0, Nil)
        val firstSum = sumArea(firstAreaList, Nil)
        val lastSum = sumArea(lastAreaList, Nil)
        (firstSum ::: lastSum).map(_._1)
    }
}
