l = input()
l += "_"
stack1 = []
stack2 = []
A = 0
for i in range(len(l)):
    if l[i] == "\\":
        stack1.append(i)
    elif l[i] == "/" and stack1:
        b = stack1.pop()
        a = i - b
        A += a
        while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
        stack2.append([b, a])
print(A)
print(len(stack2), *(i[1] for i in stack2)) l = input() l input() input l += "_" l "_" stack1 = [] stack1 [] stack2 = [] stack2 [] A = 0 A 0 for i in range(len(l)):
    if l[i] == "\\":
        stack1.append(i)
    elif l[i] == "/" and stack1:
        b = stack1.pop()
        a = i - b
        A += a
        while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
        stack2.append([b, a]) i range(len(l)) range len(l) len l if l[i] == "\\":
        stack1.append(i)
    elif l[i] == "/" and stack1:
        b = stack1.pop()
        a = i - b
        A += a
        while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
        stack2.append([b, a]) l[i] == "\\" l[i] l i "\\" stack1.append(i) stack1.append stack1 append i elif l[i] == "/" and stack1:
        b = stack1.pop()
        a = i - b
        A += a
        while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
        stack2.append([b, a]) l[i] == "/" and stack1 l[i] == "/" l[i] l i "/" stack1 b = stack1.pop() b stack1.pop() stack1.pop stack1 pop a = i - b a i - b i b A += a A a while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
         stack2 and stack2[-1][0] > b stack2 stack2[-1][0] > b stack2[-1][0] [-1] stack2 -1 0 b a += stack2.pop()[1] a stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append([b, a]) stack2.append stack2 append [b, a] b a print(A) print A i[1] for i in stack2 for i in stack2 i stack2 for i in stack2 i[1] i 1 print(len(stack2), *(i[1] for i in stack2)) print len(stack2) len stack2 *(i[1] for i in stack2) (i[1] for i in stack2) l += "_" "_" l b = stack1.pop() stack1.pop() b A += a a A l = input() input() l A = 0 0 A stack1 = [] [] stack1 stack2 = [] [] stack2 a = i - b i - b a a += stack2.pop()[1] stack2.pop()[1] a
l = input()
l += "_"
stack1 = []
stack2 = []
A = 0
for i in range(len(l)):
    if l[i] == "\\":
        stack1.append(i)
    elif l[i] == "/" and stack1:
        b = stack1.pop()
        a = i - b
        A += a
        while stack2 and stack2[-1][0] > b:
            a += stack2.pop()[1]
        stack2.append([b, a])
print(A)
print(len(stack2), *(i[1] for i in stack2))
