from collections import deque

areas = input()
S1 = deque([])
S2 = deque([])

sum_ = 0

for i,ch in enumerate(areas):
    if ch == "\\":
        S1.append(i)
    elif ch == "/" and len(S1) > 0:
        j = S1.pop()
        sum_ += i-j
        a = i-j
        while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
        S2.append([j,a])

ans = []
while len(S2) > 0:
    ans.append(S2.pop()[1])

ans.reverse()

A = sum(ans)
print(A)

ans.insert(0,len(ans))
L = map(str,ans)
print(" ".join(L)) from collections import deque areas = input() areas input() input S1 = deque([]) S1 deque([]) deque [] S2 = deque([]) S2 deque([]) deque [] sum_ = 0 sum_ 0 for i,ch in enumerate(areas):
    if ch == "\\":
        S1.append(i)
    elif ch == "/" and len(S1) > 0:
        j = S1.pop()
        sum_ += i-j
        a = i-j
        while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
        S2.append([j,a]) i ch enumerate(areas) enumerate areas if ch == "\\":
        S1.append(i)
    elif ch == "/" and len(S1) > 0:
        j = S1.pop()
        sum_ += i-j
        a = i-j
        while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
        S2.append([j,a]) ch == "\\" ch "\\" S1.append(i) S1.append S1 append i elif ch == "/" and len(S1) > 0:
        j = S1.pop()
        sum_ += i-j
        a = i-j
        while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
        S2.append([j,a]) ch == "/" and len(S1) > 0 ch == "/" ch "/" len(S1) > 0 len(S1) len S1 0 j = S1.pop() j S1.pop() S1.pop S1 pop sum_ += i-j sum_ i-j i j a = i-j a i-j i j while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
         len(S2) > 0 and S2[-1][0] > j len(S2) > 0 len(S2) len S2 0 S2[-1][0] > j S2[-1][0] [-1] S2 -1 0 j a += S2.pop()[1] a S2.pop()[1] S2.pop() S2.pop S2 pop 1 S2.append([j,a]) S2.append S2 append [j,a] j a ans = [] ans [] while len(S2) > 0:
    ans.append(S2.pop()[1]) len(S2) > 0 len(S2) len S2 0 ans.append(S2.pop()[1]) ans.append ans append S2.pop()[1] S2.pop() S2.pop S2 pop 1 ans.reverse() ans.reverse ans reverse A = sum(ans) A sum(ans) sum ans print(A) print A ans.insert(0,len(ans)) ans.insert ans insert 0 len(ans) len ans L = map(str,ans) L map(str,ans) map str ans print(" ".join(L)) print " ".join(L) " ".join " " join L ans = [] [] ans areas = input() input() areas j = S1.pop() S1.pop() j A = sum(ans) sum(ans) A sum_ += i-j i-j sum_ a += S2.pop()[1] S2.pop()[1] a S1 = deque([]) deque([]) S1 S2 = deque([]) deque([]) S2 a = i-j i-j a sum_ = 0 0 sum_ L = map(str,ans) map(str,ans) L
from collections import deque

areas = input()
S1 = deque([])
S2 = deque([])

sum_ = 0

for i,ch in enumerate(areas):
    if ch == "\\":
        S1.append(i)
    elif ch == "/" and len(S1) > 0:
        j = S1.pop()
        sum_ += i-j
        a = i-j
        while len(S2) > 0 and S2[-1][0] > j:
            a += S2.pop()[1]
        S2.append([j,a])

ans = []
while len(S2) > 0:
    ans.append(S2.pop()[1])

ans.reverse()

A = sum(ans)
print(A)

ans.insert(0,len(ans))
L = map(str,ans)
print(" ".join(L))
