from collections import deque
import sys

# downには「\」の数を入れる
down = deque()
edge = deque()
pool = deque()

for i, j in enumerate(sys.stdin.readline().splitlines()[0]):
    if j == "\\":
        down.append(i)
    # downが空でなく、かつ右斜面の場合
    elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area)

print(sum(pool))
print(len(pool), *pool)
 from collections import deque import sys sys down = deque() down deque() deque edge = deque() edge deque() deque pool = deque() pool deque() deque for i, j in enumerate(sys.stdin.readline().splitlines()[0]):
    if j == "\\":
        down.append(i)
    # downが空でなく、かつ右斜面の場合
    elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area) i j enumerate(sys.stdin.readline().splitlines()[0]) enumerate sys.stdin.readline().splitlines()[0] sys.stdin.readline().splitlines() sys.stdin.readline().splitlines sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline splitlines 0 if j == "\\":
        down.append(i)
    # downが空でなく、かつ右斜面の場合
    elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area) j == "\\" j "\\" down.append(i) down.append down append i elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area) down and j == "/" down j == "/" j "/" left = down.pop() left down.pop() down.pop down pop area = i - left area i - left i left while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

         edge if edge[-1] < left:
                break
             edge[-1] < left edge[-1] edge -1 left break edge.pop() edge.pop edge pop area += pool.pop() area pool.pop() pool.pop pool pop edge.append(left) edge.append edge append left pool.append(area) pool.append pool append area print(sum(pool)) print sum(pool) sum pool print(len(pool), *pool) print len(pool) len pool *pool pool area = i - left i - left area area += pool.pop() pool.pop() area edge = deque() deque() edge pool = deque() deque() pool down = deque() deque() down left = down.pop() down.pop() left
from collections import deque
import sys

# downには「\」の数を入れる
down = deque()
edge = deque()
pool = deque()

for i, j in enumerate(sys.stdin.readline().splitlines()[0]):
    if j == "\\":
        down.append(i)
    # downが空でなく、かつ右斜面の場合
    elif down and j == "/":
        left = down.pop()
        area = i - left

        # edgeが空になるまで
        while edge:
            # 右端が
            if edge[-1] < left:
                break
            edge.pop()
            area += pool.pop()

        edge.append(left)
        pool.append(area)

print(sum(pool))
print(len(pool), *pool)

