from collections import deque

input_list = input()
area = 0
depth_arr = deque()
area_arr = deque()

for i, input_str in enumerate(input_list):
    if "\\" == input_str:
        depth_arr.append(i)
    elif "/" == input_str:
        if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool))

areas = 0
for pos, pool in area_arr:
    areas += pool
print(areas)
print(len(area_arr), *[list[1] for list in area_arr]) from collections import deque input_list = input() input_list input() input area = 0 area 0 depth_arr = deque() depth_arr deque() deque area_arr = deque() area_arr deque() deque for i, input_str in enumerate(input_list):
    if "\\" == input_str:
        depth_arr.append(i)
    elif "/" == input_str:
        if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool)) i input_str enumerate(input_list) enumerate input_list if "\\" == input_str:
        depth_arr.append(i)
    elif "/" == input_str:
        if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool)) "\\" == input_str "\\" input_str depth_arr.append(i) depth_arr.append depth_arr append i elif "/" == input_str:
        if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool)) "/" == input_str "/" input_str if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool)) len(depth_arr) len depth_arr position = depth_arr.pop() position depth_arr.pop() depth_arr.pop depth_arr pop pool = i - position pool i - position i position area += pool area pool while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
             len(area_arr) len area_arr pre_position, pre_pool = area_arr.pop() pre_position area_arr.pop() area_arr.pop area_arr pop pre_pool if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
             position <= pre_position position pre_position pool += pre_pool pool pre_pool area_arr.append((pre_position, pre_pool)) area_arr.append area_arr append (pre_position, pre_pool) pre_position pre_pool break area_arr.append((position, pool)) area_arr.append area_arr append (position, pool) position pool areas = 0 areas 0 for pos, pool in area_arr:
    areas += pool pos pool area_arr areas += pool areas pool print(areas) print areas list[1] for list in area_arr for list in area_arr list area_arr for list in area_arr list[1] list 1 print(len(area_arr), *[list[1] for list in area_arr]) print len(area_arr) len area_arr *[list[1] for list in area_arr] [list[1] for list in area_arr] input_list = input() input() input_list area_arr = deque() deque() area_arr position = depth_arr.pop() depth_arr.pop() position areas += pool pool areas areas = 0 0 areas area = 0 0 area pool += pre_pool pre_pool pool depth_arr = deque() deque() depth_arr pre_position, pre_pool = area_arr.pop() area_arr.pop() pre_position pool = i - position i - position pool area += pool pool area pre_pool = area_arr.pop() area_arr.pop() pre_pool
from collections import deque

input_list = input()
area = 0
depth_arr = deque()
area_arr = deque()

for i, input_str in enumerate(input_list):
    if "\\" == input_str:
        depth_arr.append(i)
    elif "/" == input_str:
        if len(depth_arr):
            position = depth_arr.pop()
            pool = i - position
            area += pool

            while len(area_arr):
                pre_position, pre_pool = area_arr.pop()
                if position <= pre_position:
                    pool += pre_pool
                else:
                    area_arr.append((pre_position, pre_pool))
                    break
            area_arr.append((position, pool))

areas = 0
for pos, pool in area_arr:
    areas += pool
print(areas)
print(len(area_arr), *[list[1] for list in area_arr])