from collections import deque

stack = []
stack2 = []

input_line = input().rstrip()

menseki = 0

for i, s in enumerate(input_line):
    if s == "\\":
        stack.append(i)
    elif s == "/" and len(stack) > 0:
        j = stack.pop()
        menseki += (i - j)
        temp_menseki = 0
        while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
        stack2.append([j, temp_menseki + (i - j)])

print(menseki)
if len(stack2) > 0:
    print(len(stack2), " ".join([str(j[1]) for j in stack2]))
else:
    print("0")

 from collections import deque stack = [] stack [] stack2 = [] stack2 [] input_line = input().rstrip() input_line input().rstrip() ().rstrip () input rstrip menseki = 0 menseki 0 for i, s in enumerate(input_line):
    if s == "\\":
        stack.append(i)
    elif s == "/" and len(stack) > 0:
        j = stack.pop()
        menseki += (i - j)
        temp_menseki = 0
        while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
        stack2.append([j, temp_menseki + (i - j)]) i s enumerate(input_line) enumerate input_line if s == "\\":
        stack.append(i)
    elif s == "/" and len(stack) > 0:
        j = stack.pop()
        menseki += (i - j)
        temp_menseki = 0
        while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
        stack2.append([j, temp_menseki + (i - j)]) s == "\\" s "\\" stack.append(i) stack.append stack append i elif s == "/" and len(stack) > 0:
        j = stack.pop()
        menseki += (i - j)
        temp_menseki = 0
        while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
        stack2.append([j, temp_menseki + (i - j)]) s == "/" and len(stack) > 0 s == "/" s "/" len(stack) > 0 len(stack) len stack 0 j = stack.pop() j stack.pop() stack.pop stack pop menseki += (i - j) menseki i - j i j temp_menseki = 0 temp_menseki 0 while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
         len(stack2) > 0 and j < stack2[-1][0] len(stack2) > 0 len(stack2) len stack2 0 j < stack2[-1][0] j stack2[-1][0] [-1] stack2 -1 0 temp_menseki += stack2.pop()[1] temp_menseki stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append([j, temp_menseki + (i - j)]) stack2.append stack2 append [j, temp_menseki + (i - j)] j temp_menseki + (i - j) temp_menseki i - j i j print(menseki) print menseki if len(stack2) > 0:
    print(len(stack2), " ".join([str(j[1]) for j in stack2]))
else:
    print("0") len(stack2) > 0 len(stack2) len stack2 0 str(j[1]) for j in stack2 for j in stack2 j stack2 for j in stack2 str(j[1]) str j[1] j 1 print(len(stack2), " ".join([str(j[1]) for j in stack2])) print len(stack2) len stack2 " ".join([str(j[1]) for j in stack2]) " ".join " " join [str(j[1]) for j in stack2] print("0") print "0" menseki += (i - j) i - j menseki temp_menseki += stack2.pop()[1] stack2.pop()[1] temp_menseki stack = [] [] stack input_line = input().rstrip() input().rstrip() input_line stack2 = [] [] stack2 temp_menseki = 0 0 temp_menseki menseki = 0 0 menseki j = stack.pop() stack.pop() j
from collections import deque

stack = []
stack2 = []

input_line = input().rstrip()

menseki = 0

for i, s in enumerate(input_line):
    if s == "\\":
        stack.append(i)
    elif s == "/" and len(stack) > 0:
        j = stack.pop()
        menseki += (i - j)
        temp_menseki = 0
        while len(stack2) > 0 and j < stack2[-1][0]:
            temp_menseki += stack2.pop()[1]
                    
        stack2.append([j, temp_menseki + (i - j)])

print(menseki)
if len(stack2) > 0:
    print(len(stack2), " ".join([str(j[1]) for j in stack2]))
else:
    print("0")


