import collections

s = input()
s1 = collections.deque([])
s2 = collections.deque([])
sum_ = 0
for i,ch in enumerate(s):
    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()
print(sum(ans))
ans.insert(0,len(ans))
print(*ans) import collections collections s = input() s input() input s1 = collections.deque([]) s1 collections.deque([]) collections.deque collections deque [] s2 = collections.deque([]) s2 collections.deque([]) collections.deque collections deque [] sum_ = 0 sum_ 0 for i,ch in enumerate(s):
    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(s) enumerate s 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 print(sum(ans)) print sum(ans) sum ans ans.insert(0,len(ans)) ans.insert ans insert 0 len(ans) len ans print(*ans) print *ans ans sum_ += i - j i - j sum_ a += s2.pop()[1] s2.pop()[1] a s1 = collections.deque([]) collections.deque([]) s1 ans = [] [] ans j = s1.pop() s1.pop() j s2 = collections.deque([]) collections.deque([]) s2 s = input() input() s sum_ = 0 0 sum_ a = i - j i - j a
import collections

s = input()
s1 = collections.deque([])
s2 = collections.deque([])
sum_ = 0
for i,ch in enumerate(s):
    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()
print(sum(ans))
ans.insert(0,len(ans))
print(*ans)
