
if __name__ == "__main__":
    line = input()

    S1 = []
    S2 = []
    total = 0

    for k, v in enumerate(line):
        if v == '\\':
            S1.append(k)
        elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

    print(total)
    indiv = [str(v[1]) for v in S2]
    indiv.insert(0, str(len(S2)))
    print(' '.join(indiv))
 if __name__ == "__main__":
    line = input()

    S1 = []
    S2 = []
    total = 0

    for k, v in enumerate(line):
        if v == '\\':
            S1.append(k)
        elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

    print(total)
    indiv = [str(v[1]) for v in S2]
    indiv.insert(0, str(len(S2)))
    print(' '.join(indiv)) __name__ == "__main__" __name__ "__main__" line = input() line input() input S1 = [] S1 [] S2 = [] S2 [] total = 0 total 0 for k, v in enumerate(line):
        if v == '\\':
            S1.append(k)
        elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

     k v enumerate(line) enumerate line if v == '\\':
            S1.append(k)
        elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

     v == '\\' v '\\' S1.append(k) S1.append S1 append k elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

     v == '/' and len(S1) > 0 v == '/' v '/' len(S1) > 0 len(S1) len S1 0 left_pos = S1.pop() left_pos S1.pop() S1.pop S1 pop area = k - left_pos area k - left_pos k left_pos total += area total area while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

     True if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

     len(S2) < 1 or S2[-1][0] < left_pos len(S2) < 1 len(S2) len S2 1 S2[-1][0] < left_pos S2[-1][0] [-1] S2 -1 0 left_pos S2.append([left_pos, area]) S2.append S2 append [left_pos, area] left_pos area break btm_area = S2.pop() btm_area S2.pop() S2.pop S2 pop area += btm_area[1] area btm_area[1] btm_area 1 print(total) print total str(v[1]) for v in S2 for v in S2 v S2 for v in S2 str(v[1]) str v[1] v 1 indiv = [str(v[1]) for v in S2] indiv [str(v[1]) for v in S2] indiv.insert(0, str(len(S2))) indiv.insert indiv insert 0 str(len(S2)) str len(S2) len S2 print(' '.join(indiv)) print ' '.join(indiv) ' '.join ' ' join indiv left_pos = S1.pop() S1.pop() left_pos indiv = [str(v[1]) for v in S2] [str(v[1]) for v in S2] indiv S2 = [] [] S2 btm_area = S2.pop() S2.pop() btm_area area = k - left_pos k - left_pos area total += area area total total = 0 0 total area += btm_area[1] btm_area[1] area S1 = [] [] S1 line = input() input() line

if __name__ == "__main__":
    line = input()

    S1 = []
    S2 = []
    total = 0

    for k, v in enumerate(line):
        if v == '\\':
            S1.append(k)
        elif v == '/' and len(S1) > 0:
            left_pos = S1.pop()
            area = k - left_pos
            total += area

            while True:
                if len(S2) < 1 or S2[-1][0] < left_pos:
                    S2.append([left_pos, area])
                    break
                else:
                    btm_area = S2.pop()
                    area += btm_area[1]

    print(total)
    indiv = [str(v[1]) for v in S2]
    indiv.insert(0, str(len(S2)))
    print(' '.join(indiv))

