import java.util.*

fun main(args: Array<String>) {
    val s = readLine()!!
    val stack1 = ArrayDeque<Int>()
    val stack2 = ArrayDeque<Pair<Int, Int>>()

    for (i in 0 until s.length) {
        when(s[i]) {
            '\\' -> {
                stack1.addFirst(i)
            }
            '/' -> {
                if (stack1.isNotEmpty()) {
                    stack2.addFirst(stack1.removeFirst() to i)
                }
            }
        }
    }

    var totalArea = 0
    val lakes = mutableListOf<Int>()
    var ll = s.length

    while (stack2.isNotEmpty()) {
        val (l, r) = stack2.removeFirst()

        if (l < ll) {
            ll = l
            lakes.add(0)
        }

        totalArea += r - l
        lakes[lakes.size - 1] += r- l
    }

    println(totalArea)

    if (lakes.isEmpty()) {
        println(0)
    } else {
        println("${lakes.size} ${lakes.reversed().joinToString(" ")}")
    }
}
