string = input()
height = 0
height_list = [[0, False]]
for s in string:
    if s == '\\':
        height += -1
    elif s == '/':
        height += 1
    else:
        pass
    height_list.append([height, False])

highest = 0
for i in range(1, len(height_list)):
    if height_list[i-1][0] < height_list[i][0] <= highest:
        height_list[i][1] = True
    highest = max(highest, height_list[i][0])

puddles = []
area = 0
surface_level = None

for i in range(len(height_list)-1, -1, -1):
    if surface_level != None:
        area += surface_level - height_list[i][0]
        if surface_level == height_list[i][0]:
            puddles += [area]
            surface_level = None
            area = 0
    if surface_level == None and height_list[i][1]:
        surface_level = height_list[i][0]

puddles = puddles[::-1]
print(sum(puddles))
print(len(puddles), *puddles) string = input() string input() input height = 0 height 0 height_list = [[0, False]] height_list [[0, False]] [0, False] 0 False for s in string:
    if s == '\\':
        height += -1
    elif s == '/':
        height += 1
    else:
        pass
    height_list.append([height, False]) s string if s == '\\':
        height += -1
    elif s == '/':
        height += 1
    else:
        pass
     s == '\\' s '\\' height += -1 height -1 elif s == '/':
        height += 1
     s == '/' s '/' height += 1 height 1 height_list.append([height, False]) height_list.append height_list append [height, False] height False highest = 0 highest 0 for i in range(1, len(height_list)):
    if height_list[i-1][0] < height_list[i][0] <= highest:
        height_list[i][1] = True
    highest = max(highest, height_list[i][0]) i range(1, len(height_list)) range 1 len(height_list) len height_list if height_list[i-1][0] < height_list[i][0] <= highest:
        height_list[i][1] = True
     height_list[i-1][0] < height_list[i][0] <= highest height_list[i-1][0] < height_list[i][0] height_list[i-1][0] [i-1] height_list i-1 i 1 0 height_list[i][0] [i] height_list i 0 highest height_list[i][1] = True height_list[i][1] [i] height_list i 1 True highest = max(highest, height_list[i][0]) highest max(highest, height_list[i][0]) max highest height_list[i][0] [i] height_list i 0 puddles = [] puddles [] area = 0 area 0 surface_level = None surface_level None for i in range(len(height_list)-1, -1, -1):
    if surface_level != None:
        area += surface_level - height_list[i][0]
        if surface_level == height_list[i][0]:
            puddles += [area]
            surface_level = None
            area = 0
    if surface_level == None and height_list[i][1]:
        surface_level = height_list[i][0] i range(len(height_list)-1, -1, -1) range len(height_list)-1 len(height_list) len height_list 1 -1 -1 if surface_level != None:
        area += surface_level - height_list[i][0]
        if surface_level == height_list[i][0]:
            puddles += [area]
            surface_level = None
            area = 0
     surface_level != None surface_level None area += surface_level - height_list[i][0] area surface_level - height_list[i][0] surface_level height_list[i][0] [i] height_list i 0 if surface_level == height_list[i][0]:
            puddles += [area]
            surface_level = None
            area = 0
     surface_level == height_list[i][0] surface_level height_list[i][0] [i] height_list i 0 puddles += [area] puddles [area] area surface_level = None surface_level None area = 0 area 0 if surface_level == None and height_list[i][1]:
        surface_level = height_list[i][0] surface_level == None and height_list[i][1] surface_level == None surface_level None height_list[i][1] [i] height_list i 1 surface_level = height_list[i][0] surface_level height_list[i][0] [i] height_list i 0 puddles = puddles[::-1] puddles puddles[::-1] puddles ::-1 -1 print(sum(puddles)) print sum(puddles) sum puddles print(len(puddles), *puddles) print len(puddles) len puddles *puddles puddles area = 0 0 area area = 0 0 area height += 1 1 height puddles = [] [] puddles height_list = [[0, False]] [[0, False]] height_list height += -1 -1 height surface_level = height_list[i][0] height_list[i][0] surface_level area += surface_level - height_list[i][0] surface_level - height_list[i][0] area highest = 0 0 highest puddles += [area] [area] puddles surface_level = None None surface_level puddles = puddles[::-1] puddles[::-1] puddles string = input() input() string highest = max(highest, height_list[i][0]) max(highest, height_list[i][0]) highest height = 0 0 height surface_level = None None surface_level
string = input()
height = 0
height_list = [[0, False]]
for s in string:
    if s == '\\':
        height += -1
    elif s == '/':
        height += 1
    else:
        pass
    height_list.append([height, False])

highest = 0
for i in range(1, len(height_list)):
    if height_list[i-1][0] < height_list[i][0] <= highest:
        height_list[i][1] = True
    highest = max(highest, height_list[i][0])

puddles = []
area = 0
surface_level = None

for i in range(len(height_list)-1, -1, -1):
    if surface_level != None:
        area += surface_level - height_list[i][0]
        if surface_level == height_list[i][0]:
            puddles += [area]
            surface_level = None
            area = 0
    if surface_level == None and height_list[i][1]:
        surface_level = height_list[i][0]

puddles = puddles[::-1]
print(sum(puddles))
print(len(puddles), *puddles)
