from collections import deque

input = input()

stack = deque()
area = deque()

for i, v in enumerate(input):
    if v == "\\":
        stack.append(i)
    elif v == "/" and stack:
        j = stack.pop()
        ans = i - j
        while area and j<area[-1][0]:
            ans += area.pop()[1]
        area.append([j, ans])

B = [len(area)]
A = [i[1] for i in area]
print(sum(A))
B.extend(A)
print(*B) from collections import deque input = input() input input() input stack = deque() stack deque() deque area = deque() area deque() deque for i, v in enumerate(input):
    if v == "\\":
        stack.append(i)
    elif v == "/" and stack:
        j = stack.pop()
        ans = i - j
        while area and j<area[-1][0]:
            ans += area.pop()[1]
        area.append([j, ans]) i v enumerate(input) enumerate input if v == "\\":
        stack.append(i)
    elif v == "/" and stack:
        j = stack.pop()
        ans = i - j
        while area and j<area[-1][0]:
            ans += area.pop()[1]
        area.append([j, ans]) v == "\\" v "\\" stack.append(i) stack.append stack append i elif v == "/" and stack:
        j = stack.pop()
        ans = i - j
        while area and j<area[-1][0]:
            ans += area.pop()[1]
        area.append([j, ans]) v == "/" and stack v == "/" v "/" stack j = stack.pop() j stack.pop() stack.pop stack pop ans = i - j ans i - j i j while area and j<area[-1][0]:
            ans += area.pop()[1]
         area and j<area[-1][0] area j<area[-1][0] j area[-1][0] [-1] area -1 0 ans += area.pop()[1] ans area.pop()[1] area.pop() area.pop area pop 1 area.append([j, ans]) area.append area append [j, ans] j ans B = [len(area)] B [len(area)] len(area) len area i[1] for i in area for i in area i area for i in area i[1] i 1 A = [i[1] for i in area] A [i[1] for i in area] print(sum(A)) print sum(A) sum A B.extend(A) B.extend B extend A print(*B) print *B B ans += area.pop()[1] area.pop()[1] ans stack = deque() deque() stack area = deque() deque() area B = [len(area)] [len(area)] B input = input() input() input A = [i[1] for i in area] [i[1] for i in area] A j = stack.pop() stack.pop() j ans = i - j i - j ans
from collections import deque

input = input()

stack = deque()
area = deque()

for i, v in enumerate(input):
    if v == "\\":
        stack.append(i)
    elif v == "/" and stack:
        j = stack.pop()
        ans = i - j
        while area and j<area[-1][0]:
            ans += area.pop()[1]
        area.append([j, ans])

B = [len(area)]
A = [i[1] for i in area]
print(sum(A))
B.extend(A)
print(*B)
