import collections
import sys

S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass


print(sum(S3))

print(len(S3), *S3) import collections collections import sys sys S1 = collections.deque() S1 collections.deque() collections.deque collections deque S2 = collections.deque() S2 collections.deque() collections.deque collections deque S3 = collections.deque() S3 collections.deque() collections.deque collections deque for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass i j enumerate(sys.stdin.readline()) enumerate sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass j == '\\' j '\\' S1.append(i) S1.append S1 append i elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass j == '/' j '/' if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass S1 left_edge = S1.pop() left_edge S1.pop() S1.pop S1 pop new_puddle = i - left_edge new_puddle i - left_edge i left_edge while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
             S2 and (S2[-1] > left_edge) S2 S2[-1] > left_edge S2[-1] S2 -1 left_edge if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
             S2[-1] > left_edge S2[-1] S2 -1 left_edge S2.pop() S2.pop S2 pop new_puddle += S3.pop() new_puddle S3.pop() S3.pop S3 pop S2.append(left_edge) S2.append S2 append left_edge S3.append(new_puddle) S3.append S3 append new_puddle print(sum(S3)) print sum(S3) sum S3 print(len(S3), *S3) print len(S3) len S3 *S3 S3 S1 = collections.deque() collections.deque() S1 left_edge = S1.pop() S1.pop() left_edge new_puddle = i - left_edge i - left_edge new_puddle S3 = collections.deque() collections.deque() S3 new_puddle += S3.pop() S3.pop() new_puddle S2 = collections.deque() collections.deque() S2
import collections
import sys

S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1] > left_edge):
                if S2[-1] > left_edge:
                    S2.pop()
                    new_puddle += S3.pop()
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass


print(sum(S3))

print(len(S3), *S3)