from collections import deque
from sys import stdin
data = list(stdin.readline().rstrip())
i_stack, a_stack, b_stack = deque(), deque(), deque()
ans = 0
for i, c in enumerate(data):
    if c == '\\':
        i_stack.append(i)
    elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff)
print(ans)
print(len(a_stack), *b_stack) from collections import deque from sys import stdin data = list(stdin.readline().rstrip()) data list(stdin.readline().rstrip()) list stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip i_stack, a_stack, b_stack = deque(), deque(), deque() i_stack deque() deque a_stack deque() deque b_stack deque() deque ans = 0 ans 0 for i, c in enumerate(data):
    if c == '\\':
        i_stack.append(i)
    elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff) i c enumerate(data) enumerate data if c == '\\':
        i_stack.append(i)
    elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff) c == '\\' c '\\' i_stack.append(i) i_stack.append i_stack append i elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff) c == '/' and len(i_stack) != 0 c == '/' c '/' len(i_stack) != 0 len(i_stack) len i_stack 0 j = i_stack.pop() j i_stack.pop() i_stack.pop i_stack pop diff = i - j diff i - j i j ans += diff ans diff while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
         a_stack and a_stack[-1] > j a_stack a_stack[-1] > j a_stack[-1] a_stack -1 j diff += b_stack.pop() diff b_stack.pop() b_stack.pop b_stack pop a_stack.pop() a_stack.pop a_stack pop a_stack.append(j) a_stack.append a_stack append j b_stack.append(diff) b_stack.append b_stack append diff print(ans) print ans print(len(a_stack), *b_stack) print len(a_stack) len a_stack *b_stack b_stack i_stack, a_stack, b_stack = deque(), deque(), deque() deque() i_stack diff = i - j i - j diff diff += b_stack.pop() b_stack.pop() diff b_stack = deque(), deque(), deque() deque() b_stack a_stack, b_stack = deque(), deque(), deque() deque() a_stack ans += diff diff ans ans = 0 0 ans j = i_stack.pop() i_stack.pop() j data = list(stdin.readline().rstrip()) list(stdin.readline().rstrip()) data
from collections import deque
from sys import stdin
data = list(stdin.readline().rstrip())
i_stack, a_stack, b_stack = deque(), deque(), deque()
ans = 0
for i, c in enumerate(data):
    if c == '\\':
        i_stack.append(i)
    elif c == '/' and len(i_stack) != 0:
        j = i_stack.pop()
        diff = i - j
        ans += diff 
        while a_stack and a_stack[-1] > j:
            diff += b_stack.pop()
            a_stack.pop()
        a_stack.append(j)
        b_stack.append(diff)
print(ans)
print(len(a_stack), *b_stack)
