def analyze_map(data):
    S1 = []  # ?°´????????????????§?????????£?????¨
    S2 = []  # ?°´??????????????¢?????£?????¨

    area = 0
    for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
    return S2


if __name__ == '__main__':
    # ??????????????\???
    #data = '\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'
    #data = '\\\\///\\_/\\/'
    data = input()

    # ???????????????
    results = analyze_map(data)

    # ???????????¨???
    # print(results)
    total_area = sum([area for pos, area in results])
    if total_area:
        print(total_area)
        valid_areas = [area for start, area in results if area > 0]
        print('{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas))))
    else:
        print('0\n0') def analyze_map(data):
    S1 = []  # ?°´????????????????§?????????£?????¨
    S2 = []  # ?°´??????????????¢?????£?????¨

    area = 0
    for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
    return S2 analyze_map S1 = [] S1 [] S2 = [] S2 [] area = 0 area 0 for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
     i p enumerate(data) enumerate data if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
     p == '\\' p '\\' S1.append(i) S1.append S1 append i elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
     p == '/' p '/' if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
     S1 pos = S1.pop() pos S1.pop() S1.pop S1 pop area = (i - pos) area i - pos i pos while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                 S2 and S2[-1][0] > pos S2 S2[-1][0] > pos S2[-1][0] [-1] S2 -1 0 pos sub_pos, sub_area = S2.pop() sub_pos S2.pop() S2.pop S2 pop sub_area area += sub_area area sub_area S2.append((pos, area)) S2.append S2 append (pos, area) pos area return S2 S2 data data if __name__ == '__main__':
    # ??????????????\???
    #data = '\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'
    #data = '\\\\///\\_/\\/'
    data = input()

    # ???????????????
    results = analyze_map(data)

    # ???????????¨???
    # print(results)
    total_area = sum([area for pos, area in results])
    if total_area:
        print(total_area)
        valid_areas = [area for start, area in results if area > 0]
        print('{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas))))
    else:
        print('0\n0') __name__ == '__main__' __name__ '__main__' data = input() data input() input results = analyze_map(data) results analyze_map(data) analyze_map data area for pos, area in results for pos, area in results pos area results for pos, area in results area total_area = sum([area for pos, area in results]) total_area sum([area for pos, area in results]) sum [area for pos, area in results] if total_area:
        print(total_area)
        valid_areas = [area for start, area in results if area > 0]
        print('{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas))))
    else:
        print('0\n0') total_area print(total_area) print total_area area for start, area in results if area > 0 for start, area in results if area > 0 start area results area > 0 area 0 if area > 0 area valid_areas = [area for start, area in results if area > 0] valid_areas [area for start, area in results if area > 0] print('{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas)))) print '{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas))) '{0} {1}'.format '{0} {1}' format len(valid_areas) len valid_areas ' '.join(map(str, valid_areas)) ' '.join ' ' join map(str, valid_areas) map str valid_areas print('0\n0') print '0\n0' valid_areas = [area for start, area in results if area > 0] [area for start, area in results if area > 0] valid_areas total_area = sum([area for pos, area in results]) sum([area for pos, area in results]) total_area def analyze_map(data):
    S1 = []  # ?°´????????????????§?????????£?????¨
    S2 = []  # ?°´??????????????¢?????£?????¨

    area = 0
    for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
    return S2 def analyze_map(data):
    S1 = []  # ?°´????????????????§?????????£?????¨
    S2 = []  # ?°´??????????????¢?????£?????¨

    area = 0
    for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
    return S2 analyze_map data = input() input() data results = analyze_map(data) analyze_map(data) results
def analyze_map(data):
    S1 = []  # ?°´????????????????§?????????£?????¨
    S2 = []  # ?°´??????????????¢?????£?????¨

    area = 0
    for i, p in enumerate(data):
        if p == '\\':
            S1.append(i)  # '\'?????????????????????????¨???¶
        elif p == '/':
            if S1:
                pos = S1.pop()
                area = (i - pos)
                while S2 and S2[-1][0] > pos:
                    sub_pos, sub_area = S2.pop()
                    area += sub_area
                S2.append((pos, area))
    return S2


if __name__ == '__main__':
    # ??????????????\???
    #data = '\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\'
    #data = '\\\\///\\_/\\/'
    data = input()

    # ???????????????
    results = analyze_map(data)

    # ???????????¨???
    # print(results)
    total_area = sum([area for pos, area in results])
    if total_area:
        print(total_area)
        valid_areas = [area for start, area in results if area > 0]
        print('{0} {1}'.format(len(valid_areas), ' '.join(map(str, valid_areas))))
    else:
        print('0\n0')