# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
sample_input = list(range(3))
# sample_input[0] = '''\\//'''
# sample_input[1] = '''\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\'''
# sample_input[2] = ''''''

sample_input[0] = '''\\\\//'''
sample_input[1] = '''\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'''
sample_input[2] = ''''''

give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point
terrain_data = []

str_input = input()
list_input = list(str_input)

height = 0
left_max_height = 0
terrain_data.append([height,left_max_height, None])
for path in list_input:
    if path == '/':
        height += 1
    elif path == '\\':
        height -= 1
    left_max_height = max(left_max_height, height)
    terrain_data.append([height,left_max_height, None])

right_max_height = None # dealt as negative infinity
for index in range(len(terrain_data)-1, -1, -1):
    height = terrain_data[index][0]
    if right_max_height is None:
        right_max_height = height
    else:
        right_max_height = max(right_max_height, height)
    terrain_data[index][2] = right_max_height

pool_left = -1
pool_right = -1
area = 0
areas = []
prev_depth = 0
for data in terrain_data:
    depth = min(data[1], data[2]) - data[0]
    area += (prev_depth + depth)/2
    if depth == 0:
        if pool_left < pool_right:
            areas.append(int(area))
            area = 0
        pool_right += 1
        pool_left = pool_right
    else:
        pool_right += 1
    prev_depth = depth

print(sum(areas))
output = str(len(areas)) + ' '
for a in areas:
    output += str(a) + ' '
print(output[:-1]) sample_input = list(range(3)) sample_input list(range(3)) list range(3) range 3 sample_input[0] = '''\\\\//''' sample_input[0] sample_input 0 '''\\\\//''' sample_input[1] = '''\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\''' sample_input[1] sample_input 1 '''\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\''' sample_input[2] = '''''' sample_input[2] sample_input 2 '''''' give_sample_input = None give_sample_input None if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point give_sample_input is not None give_sample_input None sample_input_list = sample_input[give_sample_input].split('\n') sample_input_list sample_input[give_sample_input].split('\n') [give_sample_input].split [give_sample_input] sample_input give_sample_input split '\n' def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point input return sample_input_list.pop(0) sample_input_list.pop(0) sample_input_list.pop sample_input_list pop 0 terrain_data = [] terrain_data [] str_input = input() str_input input() input list_input = list(str_input) list_input list(str_input) list str_input height = 0 height 0 left_max_height = 0 left_max_height 0 terrain_data.append([height,left_max_height, None]) terrain_data.append terrain_data append [height,left_max_height, None] height left_max_height None for path in list_input:
    if path == '/':
        height += 1
    elif path == '\\':
        height -= 1
    left_max_height = max(left_max_height, height)
    terrain_data.append([height,left_max_height, None]) path list_input if path == '/':
        height += 1
    elif path == '\\':
        height -= 1
     path == '/' path '/' height += 1 height 1 elif path == '\\':
        height -= 1
     path == '\\' path '\\' height -= 1 height 1 left_max_height = max(left_max_height, height) left_max_height max(left_max_height, height) max left_max_height height terrain_data.append([height,left_max_height, None]) terrain_data.append terrain_data append [height,left_max_height, None] height left_max_height None right_max_height = None right_max_height None for index in range(len(terrain_data)-1, -1, -1):
    height = terrain_data[index][0]
    if right_max_height is None:
        right_max_height = height
    else:
        right_max_height = max(right_max_height, height)
    terrain_data[index][2] = right_max_height index range(len(terrain_data)-1, -1, -1) range len(terrain_data)-1 len(terrain_data) len terrain_data 1 -1 -1 height = terrain_data[index][0] height terrain_data[index][0] [index] terrain_data index 0 if right_max_height is None:
        right_max_height = height
    else:
        right_max_height = max(right_max_height, height)
     right_max_height is None right_max_height None right_max_height = height right_max_height height right_max_height = max(right_max_height, height) right_max_height max(right_max_height, height) max right_max_height height terrain_data[index][2] = right_max_height terrain_data[index][2] [index] terrain_data index 2 right_max_height pool_left = -1 pool_left -1 pool_right = -1 pool_right -1 area = 0 area 0 areas = [] areas [] prev_depth = 0 prev_depth 0 for data in terrain_data:
    depth = min(data[1], data[2]) - data[0]
    area += (prev_depth + depth)/2
    if depth == 0:
        if pool_left < pool_right:
            areas.append(int(area))
            area = 0
        pool_right += 1
        pool_left = pool_right
    else:
        pool_right += 1
    prev_depth = depth data terrain_data depth = min(data[1], data[2]) - data[0] depth min(data[1], data[2]) - data[0] min(data[1], data[2]) min data[1] data 1 data[2] data 2 data[0] data 0 area += (prev_depth + depth)/2 area (prev_depth + depth)/2 prev_depth + depth prev_depth depth 2 if depth == 0:
        if pool_left < pool_right:
            areas.append(int(area))
            area = 0
        pool_right += 1
        pool_left = pool_right
    else:
        pool_right += 1
     depth == 0 depth 0 if pool_left < pool_right:
            areas.append(int(area))
            area = 0
         pool_left < pool_right pool_left pool_right areas.append(int(area)) areas.append areas append int(area) int area area = 0 area 0 pool_right += 1 pool_right 1 pool_left = pool_right pool_left pool_right pool_right += 1 pool_right 1 prev_depth = depth prev_depth depth print(sum(areas)) print sum(areas) sum areas output = str(len(areas)) + ' ' output str(len(areas)) + ' ' str(len(areas)) str len(areas) len areas ' ' for a in areas:
    output += str(a) + ' ' a areas output += str(a) + ' ' output str(a) + ' ' str(a) str a ' ' print(output[:-1]) print output[:-1] output :-1 -1 output = str(len(areas)) + ' ' str(len(areas)) + ' ' output area = 0 0 area list_input = list(str_input) list(str_input) list_input right_max_height = None None right_max_height sample_input = list(range(3)) list(range(3)) sample_input height += 1 1 height right_max_height = height height right_max_height pool_left = -1 -1 pool_left str_input = input() input() str_input area += (prev_depth + depth)/2 (prev_depth + depth)/2 area height = 0 0 height height -= 1 1 height pool_left = pool_right pool_right pool_left depth = min(data[1], data[2]) - data[0] min(data[1], data[2]) - data[0] depth terrain_data = [] [] terrain_data area = 0 0 area output += str(a) + ' ' str(a) + ' ' output prev_depth = depth depth prev_depth give_sample_input = None None give_sample_input left_max_height = 0 0 left_max_height pool_right += 1 1 pool_right right_max_height = max(right_max_height, height) max(right_max_height, height) right_max_height prev_depth = 0 0 prev_depth pool_right += 1 1 pool_right height = terrain_data[index][0] terrain_data[index][0] height areas = [] [] areas sample_input_list = sample_input[give_sample_input].split('\n') sample_input[give_sample_input].split('\n') sample_input_list def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point input left_max_height = max(left_max_height, height) max(left_max_height, height) left_max_height pool_right = -1 -1 pool_right
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
sample_input = list(range(3))
# sample_input[0] = '''\\//'''
# sample_input[1] = '''\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\'''
# sample_input[2] = ''''''

sample_input[0] = '''\\\\//'''
sample_input[1] = '''\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'''
sample_input[2] = ''''''

give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
# a list of tuples (h, l, r)
# h = the hight
# l, r = max of heights of points which is left (right) or equal to this point
terrain_data = []

str_input = input()
list_input = list(str_input)

height = 0
left_max_height = 0
terrain_data.append([height,left_max_height, None])
for path in list_input:
    if path == '/':
        height += 1
    elif path == '\\':
        height -= 1
    left_max_height = max(left_max_height, height)
    terrain_data.append([height,left_max_height, None])

right_max_height = None # dealt as negative infinity
for index in range(len(terrain_data)-1, -1, -1):
    height = terrain_data[index][0]
    if right_max_height is None:
        right_max_height = height
    else:
        right_max_height = max(right_max_height, height)
    terrain_data[index][2] = right_max_height

pool_left = -1
pool_right = -1
area = 0
areas = []
prev_depth = 0
for data in terrain_data:
    depth = min(data[1], data[2]) - data[0]
    area += (prev_depth + depth)/2
    if depth == 0:
        if pool_left < pool_right:
            areas.append(int(area))
            area = 0
        pool_right += 1
        pool_left = pool_right
    else:
        pool_right += 1
    prev_depth = depth

print(sum(areas))
output = str(len(areas)) + ' '
for a in areas:
    output += str(a) + ' '
print(output[:-1])