from collections import deque
s = input()
n = len(s)
stack1 = deque()
stack2 = deque()
A = 0
a = 0
for ni in range(n):
    if s[ni] == "\\":
        stack1.append(ni)
    elif s[ni] == "/" and len(stack1) > 0 :
        tmp = stack1.pop()
        A += ni - tmp
        while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
        a += ni - tmp
        stack2.append([ni,a])
        a = 0
print(A)
print(len(stack2),*[i[1] for i in stack2]) from collections import deque s = input() s input() input n = len(s) n len(s) len s stack1 = deque() stack1 deque() deque stack2 = deque() stack2 deque() deque A = 0 A 0 a = 0 a 0 for ni in range(n):
    if s[ni] == "\\":
        stack1.append(ni)
    elif s[ni] == "/" and len(stack1) > 0 :
        tmp = stack1.pop()
        A += ni - tmp
        while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
        a += ni - tmp
        stack2.append([ni,a])
        a = 0 ni range(n) range n if s[ni] == "\\":
        stack1.append(ni)
    elif s[ni] == "/" and len(stack1) > 0 :
        tmp = stack1.pop()
        A += ni - tmp
        while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
        a += ni - tmp
        stack2.append([ni,a])
        a = 0 s[ni] == "\\" s[ni] s ni "\\" stack1.append(ni) stack1.append stack1 append ni elif s[ni] == "/" and len(stack1) > 0 :
        tmp = stack1.pop()
        A += ni - tmp
        while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
        a += ni - tmp
        stack2.append([ni,a])
        a = 0 s[ni] == "/" and len(stack1) > 0 s[ni] == "/" s[ni] s ni "/" len(stack1) > 0 len(stack1) len stack1 0 tmp = stack1.pop() tmp stack1.pop() stack1.pop stack1 pop A += ni - tmp A ni - tmp ni tmp while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
         True if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
         len(stack2) > 0 and stack2[-1][0] > tmp len(stack2) > 0 len(stack2) len stack2 0 stack2[-1][0] > tmp stack2[-1][0] [-1] stack2 -1 0 tmp a += stack2.pop()[1] a stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 break a += ni - tmp a ni - tmp ni tmp stack2.append([ni,a]) stack2.append stack2 append [ni,a] ni a a = 0 a 0 print(A) print A i[1] for i in stack2 for i in stack2 i stack2 for i in stack2 i[1] i 1 print(len(stack2),*[i[1] for i in stack2]) print len(stack2) len stack2 *[i[1] for i in stack2] [i[1] for i in stack2] a += ni - tmp ni - tmp a n = len(s) len(s) n s = input() input() s a = 0 0 a a = 0 0 a A += ni - tmp ni - tmp A stack1 = deque() deque() stack1 tmp = stack1.pop() stack1.pop() tmp a += stack2.pop()[1] stack2.pop()[1] a stack2 = deque() deque() stack2 A = 0 0 A
from collections import deque
s = input()
n = len(s)
stack1 = deque()
stack2 = deque()
A = 0
a = 0
for ni in range(n):
    if s[ni] == "\\":
        stack1.append(ni)
    elif s[ni] == "/" and len(stack1) > 0 :
        tmp = stack1.pop()
        A += ni - tmp
        while True:
            if len(stack2) > 0 and stack2[-1][0] > tmp:
                a += stack2.pop()[1]
            else:
                break
        a += ni - tmp
        stack2.append([ni,a])
        a = 0
print(A)
print(len(stack2),*[i[1] for i in stack2])
