import sys
input = sys.stdin.readline

cs_view = input().rstrip('\r\n')
list_v = list(cs_view)

stack1 = []
all_sum = 0
sum_stack = []
for i, elem in enumerate(list_v):
    if elem == '\\':
        stack1.append(i)
    elif len(stack1) > 0 and elem == '/':
        j = stack1.pop()
        all_sum += i - j
        a = i - j
        while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
        sum_stack.append([j, a])

print(all_sum)
esum = []
for a in sum_stack:
    esum.append(a[1])
esum.insert(0, len(esum))
maped_esum = map(str, esum)
str_esum = ' '.join(maped_esum)
print(str_esum)
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline cs_view = input().rstrip('\r\n') cs_view input().rstrip('\r\n') ().rstrip () input rstrip '\r\n' list_v = list(cs_view) list_v list(cs_view) list cs_view stack1 = [] stack1 [] all_sum = 0 all_sum 0 sum_stack = [] sum_stack [] for i, elem in enumerate(list_v):
    if elem == '\\':
        stack1.append(i)
    elif len(stack1) > 0 and elem == '/':
        j = stack1.pop()
        all_sum += i - j
        a = i - j
        while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
        sum_stack.append([j, a]) i elem enumerate(list_v) enumerate list_v if elem == '\\':
        stack1.append(i)
    elif len(stack1) > 0 and elem == '/':
        j = stack1.pop()
        all_sum += i - j
        a = i - j
        while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
        sum_stack.append([j, a]) elem == '\\' elem '\\' stack1.append(i) stack1.append stack1 append i elif len(stack1) > 0 and elem == '/':
        j = stack1.pop()
        all_sum += i - j
        a = i - j
        while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
        sum_stack.append([j, a]) len(stack1) > 0 and elem == '/' len(stack1) > 0 len(stack1) len stack1 0 elem == '/' elem '/' j = stack1.pop() j stack1.pop() stack1.pop stack1 pop all_sum += i - j all_sum i - j i j a = i - j a i - j i j while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
         len(sum_stack) > 0 and sum_stack[-1][0] > j len(sum_stack) > 0 len(sum_stack) len sum_stack 0 sum_stack[-1][0] > j sum_stack[-1][0] [-1] sum_stack -1 0 j a += sum_stack.pop()[1] a sum_stack.pop()[1] sum_stack.pop() sum_stack.pop sum_stack pop 1 sum_stack.append([j, a]) sum_stack.append sum_stack append [j, a] j a print(all_sum) print all_sum esum = [] esum [] for a in sum_stack:
    esum.append(a[1]) a sum_stack esum.append(a[1]) esum.append esum append a[1] a 1 esum.insert(0, len(esum)) esum.insert esum insert 0 len(esum) len esum maped_esum = map(str, esum) maped_esum map(str, esum) map str esum str_esum = ' '.join(maped_esum) str_esum ' '.join(maped_esum) ' '.join ' ' join maped_esum print(str_esum) print str_esum j = stack1.pop() stack1.pop() j esum = [] [] esum a = i - j i - j a all_sum += i - j i - j all_sum maped_esum = map(str, esum) map(str, esum) maped_esum stack1 = [] [] stack1 sum_stack = [] [] sum_stack list_v = list(cs_view) list(cs_view) list_v a += sum_stack.pop()[1] sum_stack.pop()[1] a str_esum = ' '.join(maped_esum) ' '.join(maped_esum) str_esum all_sum = 0 0 all_sum input = sys.stdin.readline sys.stdin.readline input cs_view = input().rstrip('\r\n') input().rstrip('\r\n') cs_view
import sys
input = sys.stdin.readline

cs_view = input().rstrip('\r\n')
list_v = list(cs_view)

stack1 = []
all_sum = 0
sum_stack = []
for i, elem in enumerate(list_v):
    if elem == '\\':
        stack1.append(i)
    elif len(stack1) > 0 and elem == '/':
        j = stack1.pop()
        all_sum += i - j
        a = i - j
        while len(sum_stack) > 0 and sum_stack[-1][0] > j:
            a += sum_stack.pop()[1]
        sum_stack.append([j, a])

print(all_sum)
esum = []
for a in sum_stack:
    esum.append(a[1])
esum.insert(0, len(esum))
maped_esum = map(str, esum)
str_esum = ' '.join(maped_esum)
print(str_esum)

