s = input()
stack = []
stack1 = []
tot = 0
rs = []
for i in range(len(s)):
    if s[i] == '\\':
        stack.append(i)
    elif s[i] == '/':
        if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop()
print(tot)
print(len(stack1), *(y for x,y in stack1)) s = input() s input() input stack = [] stack [] stack1 = [] stack1 [] tot = 0 tot 0 rs = [] rs [] for i in range(len(s)):
    if s[i] == '\\':
        stack.append(i)
    elif s[i] == '/':
        if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop() i range(len(s)) range len(s) len s if s[i] == '\\':
        stack.append(i)
    elif s[i] == '/':
        if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop() s[i] == '\\' s[i] s i '\\' stack.append(i) stack.append stack append i elif s[i] == '/':
        if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop() s[i] == '/' s[i] s i '/' if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop() len(stack) > 0 len(stack) len stack 0 tmp = i - stack[-1] tmp i - stack[-1] i stack[-1] stack -1 tot += tmp tot tmp while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
             len(stack1) > 0 and stack1[-1][0] > stack[-1] len(stack1) > 0 len(stack1) len stack1 0 stack1[-1][0] > stack[-1] stack1[-1][0] [-1] stack1 -1 0 stack[-1] stack -1 tmp += stack1[-1][1] tmp stack1[-1][1] [-1] stack1 -1 1 stack1.pop() stack1.pop stack1 pop stack1.append((stack[-1], tmp)) stack1.append stack1 append (stack[-1], tmp) stack[-1] stack -1 tmp stack.pop() stack.pop stack pop print(tot) print tot y for x,y in stack1 for x,y in stack1 x y stack1 for x,y in stack1 y print(len(stack1), *(y for x,y in stack1)) print len(stack1) len stack1 *(y for x,y in stack1) (y for x,y in stack1) rs = [] [] rs tot = 0 0 tot tot += tmp tmp tot tmp += stack1[-1][1] stack1[-1][1] tmp s = input() input() s stack1 = [] [] stack1 tmp = i - stack[-1] i - stack[-1] tmp stack = [] [] stack
s = input()
stack = []
stack1 = []
tot = 0
rs = []
for i in range(len(s)):
    if s[i] == '\\':
        stack.append(i)
    elif s[i] == '/':
        if len(stack) > 0:
            tmp = i - stack[-1]
            tot += tmp
            while len(stack1) > 0 and stack1[-1][0] > stack[-1]:
                tmp += stack1[-1][1]
                stack1.pop()
            stack1.append((stack[-1], tmp))
            stack.pop()
print(tot)
print(len(stack1), *(y for x,y in stack1))
