import java.util.*

fun main(args: Array<String>) {
    val stack1 = Stack<Int>()
    val stack2 = Stack<Pair<Int, Int>>()
    var sum = 0
    readLine()?.forEachIndexed { i, c ->
        if (c == '\\') {
            stack1.push(i)
        } else if (c == '/' && stack1.isNotEmpty()) {
            val j = stack1.pop()
            var a = i - j
            sum += a
            while (stack2.isNotEmpty() && stack2.peek().first > j) {
               a += stack2.pop().second
            }
            stack2.push(Pair(j, a))
        }
    }
    println(sum)
    println(stack2.map { it.second }.fold("${stack2.size}") { s, i ->
        "$s $i"
    })
}
