Buggy python submission (verdict: Time Limit Exceeded):
input_list = list(input())

height_list = [0]
height = 0
for d in input_list:
    if d == '\\':
        height += -1
        height_list.append(height)
    if d == '/':
        height += 1
        height_list.append(height)
    if d == '_':
        height_list.append(height)

highest = max(height_list)
lowest = min(height_list)
flag = False
left_side_index = 0
right_side_index = 0
left_and_right_dict = {} # key = left_side_index, value = right_side_index
skip_indices = []
while highest != lowest:
    for i in range(len(height_list)):
        if i in skip_indices:
            continue
        else:
            if height_list[i] != highest:
                continue
            else:
                if i != len(height_list) - 1 and input_list[i] == '\\':
                    for k in range(i + 1, len(height_list)):
                        if height_list[k] != highest:
                            continue
                        else:
                            if input_list[k-1] == '/':
                                left_side_index = i
                                right_side_index = k
                                flag = True
                                break
                # Get the width of a puddle
                if flag:
                    left_and_right_dict[left_side_index] = right_side_index
                    for j in range(left_side_index, right_side_index):
                        skip_indices.append(j)
                    flag = False
    highest += -1

area_list = []
for left in sorted(left_and_right_dict.keys()):
    area = 0
    surface = height_list[left]
    for i in range(left, left_and_right_dict[left]):
        if input_list[i] == '\\':
            area += abs(surface - height_list[i+1]) - 0.5
        if input_list[i] == '/':
            area += abs(surface - height_list[i]) - 0.5
        if input_list[i] == '_':
            area += abs(surface - height_list[i])
    area_list.append(int(area))

print(sum(area_list))
if area_list != []:
    print(len(area_list), end = ' ')
    print(*area_list)
else:
    print(0)


Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
from time import process_time
import sys

t1 = process_time()

input_list = list(sys.stdin.readline())
input_list.remove('\n')

#print("input_list created")

height_list = [0]
height = 0
for d in input_list:
    if d == '\\':
        height += -1
        height_list.append(height)
    if d == '/':
        height += 1
        height_list.append(height)
    if d == '_':
        height_list.append(height)

highest = max(height_list)
lowest = min(height_list)
flag = False
left_side_index = 0
right_side_index = 0
left_and_right_dict = {} # key = left_side_index, value = right_side_index
skip_indices = []
while highest != lowest:
    for i in range(len(height_list)):
        if i in skip_indices:
            continue
        else:
            if height_list[i] != highest:
                continue
            else:
                if i != len(height_list) - 1 and input_list[i] == '\\':
                    for k in range(i + 1, len(height_list)):
                        if height_list[k] != highest:
                            continue
                        else:
                            if input_list[k-1] == '/':
                                left_side_index = i
                                right_side_index = k
                                flag = True
                                break
                # Get the width of a puddle
                if flag:
                    left_and_right_dict[left_side_index] = right_side_index
                    for j in range(left_side_index, right_side_index):
                        skip_indices.append(j)
                    flag = False
    highest += -1

area_list = []
for left in sorted(left_and_right_dict.keys()):
    area = 0
    surface = height_list[left]
    for i in range(left, left_and_right_dict[left]):
        if input_list[i] == '\\':
            area += abs(surface - height_list[i+1]) - 0.5
        if input_list[i] == '/':
            area += abs(surface - height_list[i]) - 0.5
        if input_list[i] == '_':
            area += abs(surface - height_list[i])
    area_list.append(int(area))

print(sum(area_list))
if area_list != []:
    print(len(area_list), end = ' ')
    print(*area_list)
else:
    print(0)


Fixed submission:
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)