import sys
from collections import deque


def input(): return sys.stdin.readline().strip()


L = []
T = deque()
A = deque()
left = 0
total = 0

s = input()
for i, c in enumerate(s):
    if c == '\\':
        T.append(i)
    elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1]

while len(A) > 0:
    if len(A) == 1:
        a1 = A.pop()
        L.append(str(a1[1]))
        break
    a1 = A.pop()
    a2 = A.pop()
    if a1[0] < a2[0]:
        A.append((a1[0], a1[1] + a2[1]))
    else:
        L.append(str(a1[1]))
        A.append(a2)

print(total)
L.reverse()
print((str(len(L)) + ' ' + ' '.join(L)).strip())
 import sys sys from collections import deque def input(): return sys.stdin.readline().strip() input L = [] L [] T = deque() T deque() deque A = deque() A deque() deque left = 0 left 0 total = 0 total 0 s = input() s input() input for i, c in enumerate(s):
    if c == '\\':
        T.append(i)
    elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1] i c enumerate(s) enumerate s if c == '\\':
        T.append(i)
    elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1] c == '\\' c '\\' T.append(i) T.append T append i elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1] c == '/' c '/' if len(T) == 0:
            continue
         len(T) == 0 len(T) len T 0 continue if i == 0:
            continue
         i == 0 i 0 continue left = T.pop() left T.pop() T.pop T pop area = (left, i - left) area (left, i - left) left i - left i left A.append(area) A.append A append area total += area[1] total area[1] area 1 while len(A) > 0:
    if len(A) == 1:
        a1 = A.pop()
        L.append(str(a1[1]))
        break
    a1 = A.pop()
    a2 = A.pop()
    if a1[0] < a2[0]:
        A.append((a1[0], a1[1] + a2[1]))
    else:
        L.append(str(a1[1]))
        A.append(a2) len(A) > 0 len(A) len A 0 if len(A) == 1:
        a1 = A.pop()
        L.append(str(a1[1]))
        break
     len(A) == 1 len(A) len A 1 a1 = A.pop() a1 A.pop() A.pop A pop L.append(str(a1[1])) L.append L append str(a1[1]) str a1[1] a1 1 break a1 = A.pop() a1 A.pop() A.pop A pop a2 = A.pop() a2 A.pop() A.pop A pop if a1[0] < a2[0]:
        A.append((a1[0], a1[1] + a2[1]))
    else:
        L.append(str(a1[1]))
        A.append(a2) a1[0] < a2[0] a1[0] a1 0 a2[0] a2 0 A.append((a1[0], a1[1] + a2[1])) A.append A append (a1[0], a1[1] + a2[1]) a1[0] a1 0 a1[1] + a2[1] a1[1] a1 1 a2[1] a2 1 L.append(str(a1[1])) L.append L append str(a1[1]) str a1[1] a1 1 A.append(a2) A.append A append a2 print(total) print total L.reverse() L.reverse L reverse print((str(len(L)) + ' ' + ' '.join(L)).strip()) print (str(len(L)) + ' ' + ' '.join(L)).strip() str(len(L)) + ' ' + ' '.join(L)).strip str(len(L)) + ' ' + ' '.join(L) str(len(L)) + ' ' str(len(L)) str len(L) len L ' ' ' '.join(L) ' '.join ' ' join L strip a2 = A.pop() A.pop() a2 def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input a1 = A.pop() A.pop() a1 left = T.pop() T.pop() left area = (left, i - left) (left, i - left) area A = deque() deque() A a1 = A.pop() A.pop() a1 s = input() input() s total += area[1] area[1] total T = deque() deque() T left = 0 0 left total = 0 0 total L = [] [] L
import sys
from collections import deque


def input(): return sys.stdin.readline().strip()


L = []
T = deque()
A = deque()
left = 0
total = 0

s = input()
for i, c in enumerate(s):
    if c == '\\':
        T.append(i)
    elif c == '/':
        if len(T) == 0:
            continue
        if i == 0:
            continue
        left = T.pop()
        area = (left, i - left)
        A.append(area)
        total += area[1]

while len(A) > 0:
    if len(A) == 1:
        a1 = A.pop()
        L.append(str(a1[1]))
        break
    a1 = A.pop()
    a2 = A.pop()
    if a1[0] < a2[0]:
        A.append((a1[0], a1[1] + a2[1]))
    else:
        L.append(str(a1[1]))
        A.append(a2)

print(total)
L.reverse()
print((str(len(L)) + ' ' + ' '.join(L)).strip())

