s = input()

sum = 0
process_stack = []
puddle_stack = []

length = len(s)

for i in range(length):
    if s[i] == "\\":
        process_stack.append(i)
    elif s[i] == "/":
        if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge))

print(sum)

result_string = ""
puddle_num = len(puddle_stack)
result_string += str(puddle_num)
for i in range(len(puddle_stack)):
    result_string += " "
    result_string += str(puddle_stack.pop(0)[1])

print(result_string) s = input() s input() input sum = 0 sum 0 process_stack = [] process_stack [] puddle_stack = [] puddle_stack [] length = len(s) length len(s) len s for i in range(length):
    if s[i] == "\\":
        process_stack.append(i)
    elif s[i] == "/":
        if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge)) i range(length) range length if s[i] == "\\":
        process_stack.append(i)
    elif s[i] == "/":
        if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge)) s[i] == "\\" s[i] s i "\\" process_stack.append(i) process_stack.append process_stack append i elif s[i] == "/":
        if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge)) s[i] == "/" s[i] s i "/" if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge)) process_stack edge = process_stack.pop() edge process_stack.pop() process_stack.pop process_stack pop sum += i - edge sum i - edge i edge puddle_sum = 0 puddle_sum 0 while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
             puddle_stack if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                 puddle_stack[len(puddle_stack) - 1][0] < edge puddle_stack[len(puddle_stack) - 1][0] [len(puddle_stack) - 1] puddle_stack len(puddle_stack) - 1 len(puddle_stack) len puddle_stack 1 0 edge break puddle_sum += puddle_stack.pop()[1] puddle_sum puddle_stack.pop()[1] puddle_stack.pop() puddle_stack.pop puddle_stack pop 1 puddle_stack.append((edge, puddle_sum + i - edge)) puddle_stack.append puddle_stack append (edge, puddle_sum + i - edge) edge puddle_sum + i - edge puddle_sum + i puddle_sum i edge print(sum) print sum result_string = "" result_string "" puddle_num = len(puddle_stack) puddle_num len(puddle_stack) len puddle_stack result_string += str(puddle_num) result_string str(puddle_num) str puddle_num for i in range(len(puddle_stack)):
    result_string += " "
    result_string += str(puddle_stack.pop(0)[1]) i range(len(puddle_stack)) range len(puddle_stack) len puddle_stack result_string += " " result_string " " result_string += str(puddle_stack.pop(0)[1]) result_string str(puddle_stack.pop(0)[1]) str puddle_stack.pop(0)[1] puddle_stack.pop(0) puddle_stack.pop puddle_stack pop 0 1 print(result_string) print result_string sum += i - edge i - edge sum edge = process_stack.pop() process_stack.pop() edge puddle_num = len(puddle_stack) len(puddle_stack) puddle_num puddle_sum = 0 0 puddle_sum result_string += str(puddle_num) str(puddle_num) result_string length = len(s) len(s) length process_stack = [] [] process_stack s = input() input() s result_string += str(puddle_stack.pop(0)[1]) str(puddle_stack.pop(0)[1]) result_string result_string += " " " " result_string sum = 0 0 sum puddle_sum += puddle_stack.pop()[1] puddle_stack.pop()[1] puddle_sum puddle_stack = [] [] puddle_stack result_string = "" "" result_string
s = input()

sum = 0
process_stack = []
puddle_stack = []

length = len(s)

for i in range(length):
    if s[i] == "\\":
        process_stack.append(i)
    elif s[i] == "/":
        if process_stack:
            edge = process_stack.pop()
            sum += i - edge
            puddle_sum = 0
            while puddle_stack:
                if puddle_stack[len(puddle_stack) - 1][0] < edge:
                    break;
                puddle_sum += puddle_stack.pop()[1]
            puddle_stack.append((edge, puddle_sum + i - edge))

print(sum)

result_string = ""
puddle_num = len(puddle_stack)
result_string += str(puddle_num)
for i in range(len(puddle_stack)):
    result_string += " "
    result_string += str(puddle_stack.pop(0)[1])

print(result_string)
