def main():
    cross_sections = input()
    s1 = []
    s2 = []
    total_surface = 0
    for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

    print(total_surface)
    if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2))


if __name__ == "__main__":
    main()
 def main():
    cross_sections = input()
    s1 = []
    s2 = []
    total_surface = 0
    for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

    print(total_surface)
    if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2)) main cross_sections = input() cross_sections input() input s1 = [] s1 [] s2 = [] s2 [] total_surface = 0 total_surface 0 for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

     i cross_section enumerate(cross_sections) enumerate cross_sections if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

     cross_section == '\\' cross_section '\\' s1.append(i) s1.append s1 append i elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

     cross_section == '/' and s1 cross_section == '/' cross_section '/' s1 ip = s1.pop() ip s1.pop() s1.pop s1 pop sub_surface = i - ip sub_surface i - ip i ip total_surface += sub_surface total_surface sub_surface for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
             s reversed(s2) reversed s2 if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
             s[0] > ip s[0] s 0 ip sub_surface += s2.pop()[1] sub_surface s2.pop()[1] s2.pop() s2.pop s2 pop 1 break s2.append((ip, sub_surface)) s2.append s2 append (ip, sub_surface) ip sub_surface print(total_surface) print total_surface if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2)) s2 print(len(s2), ' '.join(map(lambda x: str(x[1]), s2))) print len(s2) len s2 ' '.join(map(lambda x: str(x[1]), s2)) ' '.join ' ' join map(lambda x: str(x[1]), s2) map lambda x: str(x[1]) str(x[1]) str x[1] x 1 x s2 print(len(s2)) print len(s2) len s2 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    cross_sections = input()
    s1 = []
    s2 = []
    total_surface = 0
    for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

    print(total_surface)
    if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2)) def main():
    cross_sections = input()
    s1 = []
    s2 = []
    total_surface = 0
    for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

    print(total_surface)
    if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2)) main
def main():
    cross_sections = input()
    s1 = []
    s2 = []
    total_surface = 0
    for i, cross_section in enumerate(cross_sections):
        if cross_section == '\\':
            s1.append(i)
        elif cross_section == '/' and s1:
            ip = s1.pop()
            # calc total surface
            sub_surface = i - ip
            total_surface += sub_surface
            # calc sub surface
            for s in reversed(s2):
                if s[0] > ip:
                    sub_surface += s2.pop()[1]
                else:
                    break
            s2.append((ip, sub_surface))

    print(total_surface)
    if s2:
        print(len(s2), ' '.join(map(lambda x: str(x[1]), s2)))
    else:
        print(len(s2))


if __name__ == "__main__":
    main()

