S = [s for s in input()]

stack1 = []
stack2 = []

for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area))

print(sum([s[1] for s in stack2]))
print(len(stack2), *[s[1] for s in stack2]) s for s in input() for s in input() s input() input for s in input() s S = [s for s in input()] S [s for s in input()] stack1 = [] stack1 [] stack2 = [] stack2 [] for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area)) i range(len(S)) range len(S) len S if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area)) S[i] == '\\' S[i] S i '\\' stack1.append(i) stack1.append stack1 append i elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area)) S[i] == '/' S[i] S i '/' if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area)) len(stack1) != 0 len(stack1) len stack1 0 pos = stack1.pop() pos stack1.pop() stack1.pop stack1 pop area = i - pos area i - pos i pos while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
             len(stack2) != 0 len(stack2) len stack2 0 pair = stack2.pop() pair stack2.pop() stack2.pop stack2 pop if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
             pos < pair[0] pos pair[0] pair 0 area += pair[1] area pair[1] pair 1 stack2.append(pair) stack2.append stack2 append pair break stack2.append((pos, area)) stack2.append stack2 append (pos, area) pos area s[1] for s in stack2 for s in stack2 s stack2 for s in stack2 s[1] s 1 print(sum([s[1] for s in stack2])) print sum([s[1] for s in stack2]) sum [s[1] for s in stack2] s[1] for s in stack2 for s in stack2 s stack2 for s in stack2 s[1] s 1 print(len(stack2), *[s[1] for s in stack2]) print len(stack2) len stack2 *[s[1] for s in stack2] [s[1] for s in stack2] S = [s for s in input()] [s for s in input()] S pair = stack2.pop() stack2.pop() pair pos = stack1.pop() stack1.pop() pos area += pair[1] pair[1] area stack1 = [] [] stack1 stack2 = [] [] stack2 area = i - pos i - pos area
S = [s for s in input()]

stack1 = []
stack2 = []

for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if len(stack1) != 0:
            pos = stack1.pop()
            area = i - pos
            while len(stack2) != 0:
                pair = stack2.pop()
                if pos < pair[0]:
                    area += pair[1]
                else:
                    stack2.append(pair)
                    break
            stack2.append((pos, area))

print(sum([s[1] for s in stack2]))
print(len(stack2), *[s[1] for s in stack2])
