from collections import deque



input_list = eval(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



if __name__ == "__main__":

    slopes = input()

    total_area = 0

    slope_queue = deque()

    area_queue = deque()



    for i, slope in enumerate(slopes):

        if slope == '\\':

            slope_queue.append(i)

        elif slope == '/' and len(slope_queue) != 0:

            target = slope_queue.pop()

            area = i - target

            total_area += area

            if len(area_queue) == 0:

                area_queue.append((target, area))

            else:

                temp_area = area

                while True:

                    target_area = area_queue.pop()

                    if target < target_area[0]:

                        temp_area += target_area[1]

                        if len(area_queue) == 0:

                            area_queue.append((target, temp_area))

                            break

                    else:

                        area_queue.append(target_area)

                        area_queue.append((target, temp_area))

                        break



    print(total_area)

    if len(area_queue) == 0:

        print(len(area_queue), end='\n')

    else:

        print(len(area_queue), end=' ')

    for i, area in enumerate(area_queue):

        if i < len(area_queue) - 1:

            print(area[1], end=' ')

        else:

            print(area[1], end='\n')

from collections import deque

input_list = eval(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

if __name__ == "__main__":
    slopes = input()
    total_area = 0
    slope_queue = deque()
    area_queue = deque()
    for i, slope in enumerate(slopes):
        if slope == "\\":
            slope_queue.append(i)
        elif slope == "/" and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break
    print(total_area)
    if len(area_queue) == 0:
        print(len(area_queue), end="\n")
    else:
        print(len(area_queue), end=" ")
    for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=" ")
        else:
            print(area[1], end="\n")

-input_list = eval(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])) +if __name__ == "__main__": +    slopes = input() +    total_area = 0 +    slope_queue = deque() +    area_queue = deque() +    for i, slope in enumerate(slopes): +        if slope == "\\": +            slope_queue.append(i) +        elif slope == "/" and len(slope_queue) != 0: +            target = slope_queue.pop() +            area = i - target +            total_area += area +            if len(area_queue) == 0: +                area_queue.append((target, area)) +            else: +                temp_area = area +                while True: +                    target_area = area_queue.pop() +                    if target < target_area[0]: +                        temp_area += target_area[1] +                        if len(area_queue) == 0: +                            area_queue.append((target, temp_area)) +                            break +                    else: +                        area_queue.append(target_area) +                        area_queue.append((target, temp_area)) +                        break +    print(total_area) +    if len(area_queue) == 0: +        print(len(area_queue), end="\n") +    else: +        print(len(area_queue), end=" ") +    for i, area in enumerate(area_queue): +        if i < len(area_queue) - 1: +            print(area[1], end=" ") +        else: +            print(area[1], end="\n")