def cross_section_area(data):
    area = 0;
    sections = [];
    stack = [];
    for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
    print(area);
    print(len(sections), *[n[1] for n in sections]);

cross_section_area(input()); def cross_section_area(data):
    area = 0;
    sections = [];
    stack = [];
    for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
    print(area);
    print(len(sections), *[n[1] for n in sections]); cross_section_area area = 0 area 0 sections = [] sections [] stack = [] stack [] for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
     i range(len(data)) range len(data) len data if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
     data[i] == '\\' data[i] data i '\\' stack.append(i) stack.append stack append i elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
     data[i] == '/' and len(stack) > 0 data[i] == '/' data[i] data i '/' len(stack) > 0 len(stack) len stack 0 j = stack.pop() j stack.pop() stack.pop stack pop section_area = i - j section_area i - j i j area += section_area area section_area while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
             len(sections) > 0 and sections[-1][0] > j len(sections) > 0 len(sections) len sections 0 sections[-1][0] > j sections[-1][0] [-1] sections -1 0 j section_area += sections[-1][1] section_area sections[-1][1] [-1] sections -1 1 sections.pop() sections.pop sections pop sections.append([j, section_area]) sections.append sections append [j, section_area] j section_area print(area) print area n[1] for n in sections for n in sections n sections for n in sections n[1] n 1 print(len(sections), *[n[1] for n in sections]) print len(sections) len sections *[n[1] for n in sections] [n[1] for n in sections] data data cross_section_area(input()) cross_section_area input() input def cross_section_area(data):
    area = 0;
    sections = [];
    stack = [];
    for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
    print(area);
    print(len(sections), *[n[1] for n in sections]); def cross_section_area(data):
    area = 0;
    sections = [];
    stack = [];
    for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
    print(area);
    print(len(sections), *[n[1] for n in sections]); cross_section_area
def cross_section_area(data):
    area = 0;
    sections = [];
    stack = [];
    for i in range(len(data)):
        if data[i] == '\\':
            stack.append(i);
        elif data[i] == '/' and len(stack) > 0:
            j = stack.pop();
            section_area = i - j;
            area += section_area;
            while len(sections) > 0 and sections[-1][0] > j:
                section_area += sections[-1][1];
                sections.pop();
            sections.append([j, section_area]);
    print(area);
    print(len(sections), *[n[1] for n in sections]);

cross_section_area(input());
