input_string = input()
total_area = 0
num_lake = 0
lake_areas = []

v_lakes = [] # (湖の始まりidx, 湖の面積)
idx_stack = [] #地形管理

for i, c in enumerate(input_string):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        poped_i = idx_stack.pop()
        total_area += i - poped_i
        tmp_area = i - poped_i
        while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
        v_lakes.append((poped_i, tmp_area))
#print(v_lakes)

print(total_area)
ans = [area[1] for area in v_lakes] 
print(len(v_lakes), *ans) input_string = input() input_string input() input total_area = 0 total_area 0 num_lake = 0 num_lake 0 lake_areas = [] lake_areas [] v_lakes = [] v_lakes [] idx_stack = [] idx_stack [] for i, c in enumerate(input_string):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        poped_i = idx_stack.pop()
        total_area += i - poped_i
        tmp_area = i - poped_i
        while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
        v_lakes.append((poped_i, tmp_area))
#print(v_lakes) i c enumerate(input_string) enumerate input_string if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        poped_i = idx_stack.pop()
        total_area += i - poped_i
        tmp_area = i - poped_i
        while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
        v_lakes.append((poped_i, tmp_area))
#print(v_lakes) c == "\\" c "\\" idx_stack.append(i) idx_stack.append idx_stack append i elif c == "/" and idx_stack:
        poped_i = idx_stack.pop()
        total_area += i - poped_i
        tmp_area = i - poped_i
        while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
        v_lakes.append((poped_i, tmp_area))
#print(v_lakes) c == "/" and idx_stack c == "/" c "/" idx_stack poped_i = idx_stack.pop() poped_i idx_stack.pop() idx_stack.pop idx_stack pop total_area += i - poped_i total_area i - poped_i i poped_i tmp_area = i - poped_i tmp_area i - poped_i i poped_i while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
         v_lakes and v_lakes[-1][0] > poped_i v_lakes v_lakes[-1][0] > poped_i v_lakes[-1][0] [-1] v_lakes -1 0 poped_i tmp_area += v_lakes.pop()[1] tmp_area v_lakes.pop()[1] v_lakes.pop() v_lakes.pop v_lakes pop 1 v_lakes.append((poped_i, tmp_area)) v_lakes.append v_lakes append (poped_i, tmp_area) poped_i tmp_area print(total_area) print total_area area[1] for area in v_lakes for area in v_lakes area v_lakes for area in v_lakes area[1] area 1 ans = [area[1] for area in v_lakes] ans [area[1] for area in v_lakes] print(len(v_lakes), *ans) print len(v_lakes) len v_lakes *ans ans ans = [area[1] for area in v_lakes] [area[1] for area in v_lakes] ans tmp_area += v_lakes.pop()[1] v_lakes.pop()[1] tmp_area tmp_area = i - poped_i i - poped_i tmp_area lake_areas = [] [] lake_areas poped_i = idx_stack.pop() idx_stack.pop() poped_i total_area += i - poped_i i - poped_i total_area v_lakes = [] [] v_lakes total_area = 0 0 total_area num_lake = 0 0 num_lake input_string = input() input() input_string idx_stack = [] [] idx_stack
input_string = input()
total_area = 0
num_lake = 0
lake_areas = []

v_lakes = [] # (湖の始まりidx, 湖の面積)
idx_stack = [] #地形管理

for i, c in enumerate(input_string):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        poped_i = idx_stack.pop()
        total_area += i - poped_i
        tmp_area = i - poped_i
        while v_lakes and v_lakes[-1][0] > poped_i:
            tmp_area += v_lakes.pop()[1]
            
        v_lakes.append((poped_i, tmp_area))
#print(v_lakes)

print(total_area)
ans = [area[1] for area in v_lakes] 
print(len(v_lakes), *ans)
