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 = stack == Nil
    def toList(): List[T] = stack
}
object Stack {
    def apply[T]() = new Stack[T](Nil)
}
object Main {
    def main(args: Array[String]): Unit = {
        val input = readLine.split("").toList
        val (areas, sum) = calcArea(input)
        if (sum == 0) {
            println("0")
            println("0")
        } else {
            println(sum)
            println(areas.length + " " + areas.mkString(" "))
        }
        
    }
    def calcArea(input: List[String]): (List[Int], Int) = {
        def go(list: List[(String, Int)], stack1: Stack[Int], stack2: Stack[(Int, Int)], sum: Int): (List[Int], Int) = list match {
            case Nil => (stack2.toList.map(_._2).reverse, sum)
            case (x @ (symbol, index)) :: xs => symbol match {
                case "_" => go(xs, stack1, stack2, sum)
                case "\\" => go(xs, stack1.push(index), stack2, sum)
                case "/" => stack1 match {
                    case s1 if s1.isEmpty => go(xs, stack1, stack2, sum)
                    case _ => {
                        val top = stack1.top.get
                        val area = index - top
                        go(xs, stack1.pop, sumStack(stack2, top, area), sum + area)
                    }
                }
            }
        }
        def sumStack(stack2: Stack[(Int, Int)], index: Int, area: Int): Stack[(Int, Int)] = stack2 match {
            case s if stack2.isEmpty => stack2.push((index, area))
            case s => s.top.get match {
                case (i, a) if i > index => sumStack(s.pop, index, area + a)
                case _ => s.push((index, area))
            }
        }
        go(input.zipWithIndex, Stack[Int](), Stack[(Int, Int)], 0)
    }
}
