Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(puddle_list):
    depth = 0
    score = 0
    for symbol in puddle_list:
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        if symbol == "/":
            depth -= 1
            score += depth + 0.5
        if symbol == "_":
            score += depth
            
    return int(score)

def get_puddle_index(diagram_list):

    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            depth += 1
        elif symbol == "/":
            depth = depth - 1

        if depth == 0:
            return i

    return False

def cal(diagram):
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    while i < len(diagram):
        if diagram[i] == "\\":
            puddle_end = get_puddle_index(diagram[i:])
            if puddle_end:
                puddle_list.append(diagram[i: i + puddle_end + 1])
                i = i + puddle_end
        i += 1

    for puddle in puddle_list:
        puddle_areas.append(cal_puddle(puddle))
        
    return puddle_areas

        
if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(puddle_list):
    depth = 0
    score = 0
    for symbol in puddle_list:
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        if symbol == "/":
            depth -= 1
            score += depth + 0.5
        if symbol == "_":
            score += depth
            
    return int(score)

def get_puddle_index(diagram_list):

    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            depth += 1
        elif symbol == "/":
            depth = depth - 1

        if depth == 0:
            return i

    return False

def cal(diagram):
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    while i < len(diagram):
        if diagram[i] == "\\":
            puddle_end = get_puddle_index(diagram[i:])
            if puddle_end:
                puddle_areas.append(cal_puddle(diagram[i: i + puddle_end + 1]))
                i = i + puddle_end
        i += 1

    for puddle in puddle_list:
        puddle_areas.append(cal_puddle(puddle))
        
    return puddle_areas

        
if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(puddle_list):
    depth = 0
    score = 0
    for symbol in puddle_list:
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        if symbol == "/":
            depth -= 1
            score += depth + 0.5
        if symbol == "_":
            score += depth
            
    return int(score)

def get_puddle_index(diagram_list):

    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            depth += 1
        elif symbol == "/":
            depth = depth - 1

        if depth == 0:
            return i

    return False

def cal(diagram):
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    while i < len(diagram):
        if diagram[i] == "\\":
            puddle_end = get_puddle_index(diagram[i:])
            if puddle_end:
                puddle_areas.append(cal_puddle(diagram[i: i + puddle_end + 1]))
                i = i + puddle_end
        i += 1

    return puddle_areas

if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(puddle_list):
    depth = 0
    score = 0
    for symbol in puddle_list:
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        if symbol == "/":
            depth -= 1
            score += depth + 0.5
        if symbol == "_":
            score += depth
            
    return int(score)

def get_puddle_index(diagram_list):

    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            depth += 1
        elif symbol == "/":
            depth = depth - 1

        if depth == 0:
            return i

    return False

def cal(diagram):
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    while i < len(diagram):
        if diagram[i] == "\\":
            puddle_end = get_puddle_index(diagram[i:])
            if puddle_end:
                puddle_areas.append(cal_puddle(diagram[i: i + puddle_end + 1]))
                i = i + puddle_end
        i += 1

    return puddle_areas

if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(diagram_list):
    score = 0
    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        elif symbol == "/":
            depth = depth - 1
            score += depth + 0.5
        elif symbol == "_":
            score += depth
            
        if depth == 0:
            return (int(score),i)

    return (False, False)

def cal(diagram):
    
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    score = []
    while i < len(diagram):
        if diagram[i] == "\\":
            res = cal_puddle(diagram[i:])
            if res[1]:
                i = i + res[1]
                score.append(res[0])
        i += 1

    return score

if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(diagram_list):
    score = 0
    depth = 0
    for i, symbol in enumerate(diagram_list):
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        elif symbol == "/":
            depth = depth - 1
            score += depth + 0.5
        elif symbol == "_":
            score += depth
            
        if depth == 0:
            return (int(score),i)

    return (False, False)

def cal(diagram):
    
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    score = []
    while i < len(diagram):
        if diagram[i] == "\\":
            res = cal_puddle(diagram[i:])
            if res[1]:
                i = i + res[1]
                score.append(res[0])
        i += 1

    return score

if __name__ == "__main__":
    a = input()
    result = cal(a)
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
#?°´??????????????¢????¨????
import re

def cal_puddle(diagram_list):
    score = 0
    depth = 0
    
    for i, symbol in enumerate(diagram_list):
        
        if symbol == "\\":
            score += depth + 0.5
            depth += 1
        elif symbol == "/":
            depth = depth - 1
            score += depth + 0.5
        elif symbol == "_":
            score += depth
            continue
        
        if depth == 0:
            return int(score)

    return None

def cal(diagram):
    
    puddle_areas = []
    diagram_list = []

    puddle_list = []
    i = 0
    score = []
    while i < len(diagram):
        if diagram[i] == "\\":
            res = cal_puddle(diagram[i:])
            if res[1]:
                i = i + res[1]
                score.append(res[0])
        i += 1

    return score
def cal_revision(diagram):

    hight = 0
    hight_list = []
    hight_index_list = []
    in_puddle = False
    for i, s in enumerate(diagram + "\\"):
        if s == "\\":
            if not in_puddle:
                in_puddle = True
                hight_list.append(hight)
                hight_index_list.append(i)
            hight -= 1
        elif s == "/":
            in_puddle = False
            hight += 1

    puddle_list = []
    i = 0
    while i < len(hight_list) - 1:
        if hight_list[i] <= hight_list[i + 1]:
            puddle_list.append((hight_index_list[i], hight_index_list[i + 1]))
            i = i + 1
        else:
            hight_list[i] -= 1
            hight_index_list[i] += 1
            if hight_list[i] in hight_list[i + 1:]:
                index = i + hight_list[i + 1:].index(hight_list[i]) + 1
                puddle_list.append((hight_index_list[i], hight_index_list[index]))
                i = index

    result = [cal_puddle(diagram[s:e]) for s, e in puddle_list]
    print(sum(result))
    print(len(result), " ".join([str(a) for a in result]))
if __name__ == "__main__":
    a = input()
    cal_revision(a)
    #print(sum(result))
    #print(str(len(result)) + "".join([" " + str(a) for a in result]))

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_top = top_list[i + 1]
        if cur_top[0] <= next_top[0]:
            puddles.append((cur_top[1], next_top[1]))
            i = i + 1
        elif cur_top[0] == max(hight_list[i + 1:]):
            
            max_top_index = i + hight_list[i+1:].index(max(hight_list[i + 1:])) + 1
            puddles.append((cur_top[1], top_list[max_top_index][1]))
            i = max_top_index
        elif cur_top[0] > max(hight_list[i + 1:]):
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
            
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()

Fixed submission:
def cal_puddle(puddle):
    depth = 0
    score = 0
    for s in puddle:
        if s == "\\":
            score += depth + 0.5
            depth += 1
        elif s == "/":
            depth -= 1
            score += depth + 0.5
        elif s == "_":
            score += depth

        if depth == 0:
            return int(score)
    return int(score)

def get_puddles(diagram):
    hight = 0
    top_list = []
    in_puddle = True
    for index, s in enumerate(diagram + "\\"):
        if s == "/":
            in_puddle = True
            hight += 1
        if s == "\\":
            if in_puddle:
                in_puddle = False
                top_list.append([hight, index])
            hight -= 1

    puddles = []
    prev_hight = 0
    hight_list = [h for h, i in top_list]
    i = 0
    while i < len(top_list) - 1:
        cur_top = top_list[i]
        next_tops = list(filter(lambda top:cur_top[0] <= top[0], top_list[i + 1:]))
        #print(next_tops)
        if next_tops:
            next_top = next_tops[0]
            puddles.append((cur_top[1], next_top[1]))
            i = top_list.index(next_top)
        else:
            cur_top[0] -= 1
            cur_top[1] += diagram[cur_top[1] + 1:].index("\\") + 1
    #print(hight_list)
    #print(top_list)
    #print(puddles)
    return puddles

def main():
    diagram = input()
    result = []
    for s,e in get_puddles(diagram):
        result.append(cal_puddle(diagram[s:e]))
    print(sum(result))
    print(str(len(result)) + "".join([" " + str(i) for i in result]))
if __name__ == "__main__":
    main()