"""
アルゴリズムとデータ構造 P.116
をPythonで書いた
"""

s = input()
stack1 = list()
stack2 = list()
sm = 0

for i, c in enumerate(s):
    if c == '\\':
        stack1.append(i)
        continue

    if c == '/' and len(stack1) > 0:
        j = stack1.pop()
        sm += i - j
        a = i - j
        while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
        stack2.append((j, a))

print(sm)
ans = list()
ans.append(len(stack2))
for _, a in stack2:
    ans.append(a)
print(" ".join([str(i) for i in ans]))
 """
アルゴリズムとデータ構造 P.116
をPythonで書いた
""" s = input() s input() input stack1 = list() stack1 list() list stack2 = list() stack2 list() list sm = 0 sm 0 for i, c in enumerate(s):
    if c == '\\':
        stack1.append(i)
        continue

    if c == '/' and len(stack1) > 0:
        j = stack1.pop()
        sm += i - j
        a = i - j
        while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
        stack2.append((j, a)) i c enumerate(s) enumerate s if c == '\\':
        stack1.append(i)
        continue

     c == '\\' c '\\' stack1.append(i) stack1.append stack1 append i continue if c == '/' and len(stack1) > 0:
        j = stack1.pop()
        sm += i - j
        a = i - j
        while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
        stack2.append((j, a)) c == '/' and len(stack1) > 0 c == '/' c '/' len(stack1) > 0 len(stack1) len stack1 0 j = stack1.pop() j stack1.pop() stack1.pop stack1 pop sm += i - j sm i - j i j a = i - j a i - j i j while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
         len(stack2) > 0 and stack2[-1][0] > j len(stack2) > 0 len(stack2) len stack2 0 stack2[-1][0] > j stack2[-1][0] [-1] stack2 -1 0 j a += stack2.pop()[1] a stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append((j, a)) stack2.append stack2 append (j, a) j a print(sm) print sm ans = list() ans list() list ans.append(len(stack2)) ans.append ans append len(stack2) len stack2 for _, a in stack2:
    ans.append(a) _ a stack2 ans.append(a) ans.append ans append a str(i) for i in ans for i in ans i ans for i in ans str(i) str i print(" ".join([str(i) for i in ans])) print " ".join([str(i) for i in ans]) " ".join " " join [str(i) for i in ans] s = input() input() s j = stack1.pop() stack1.pop() j sm = 0 0 sm ans = list() list() ans stack2 = list() list() stack2 a = i - j i - j a a += stack2.pop()[1] stack2.pop()[1] a stack1 = list() list() stack1 sm += i - j i - j sm
"""
アルゴリズムとデータ構造 P.116
をPythonで書いた
"""

s = input()
stack1 = list()
stack2 = list()
sm = 0

for i, c in enumerate(s):
    if c == '\\':
        stack1.append(i)
        continue

    if c == '/' and len(stack1) > 0:
        j = stack1.pop()
        sm += i - j
        a = i - j
        while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
        stack2.append((j, a))

print(sm)
ans = list()
ans.append(len(stack2))
for _, a in stack2:
    ans.append(a)
print(" ".join([str(i) for i in ans]))

