# -*- coding: utf-8 -*-


if __name__ == '__main__':

    s1 = []
    s2 = []
    all_area = 0
    
    for i, c in enumerate(input()):
        if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
    print(all_area)
    ret = [len(s2)]
    for w in s2:
        ret.append(w[1])
    print(" ".join(map(str, ret)))
 if __name__ == '__main__':

    s1 = []
    s2 = []
    all_area = 0
    
    for i, c in enumerate(input()):
        if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
    print(all_area)
    ret = [len(s2)]
    for w in s2:
        ret.append(w[1])
    print(" ".join(map(str, ret))) __name__ == '__main__' __name__ '__main__' s1 = [] s1 [] s2 = [] s2 [] all_area = 0 all_area 0 for i, c in enumerate(input()):
        if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
     i c enumerate(input()) enumerate input() input if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
     c == "\\" c "\\" s1.append([c, i]) s1.append s1 append [c, i] c i elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
     c == "/" c "/" if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
     len(s1) > 0 len(s1) len s1 0 _, j = s1.pop() _ s1.pop() s1.pop s1 pop j area = i - j area i - j i j all_area += area all_area area while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                 len(s2)>0 and s2[-1][0]>j len(s2)>0 len(s2) len s2 0 s2[-1][0]>j s2[-1][0] [-1] s2 -1 0 j area += s2.pop()[1] area s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([j, area]) s2.append s2 append [j, area] j area print(all_area) print all_area ret = [len(s2)] ret [len(s2)] len(s2) len s2 for w in s2:
        ret.append(w[1])
     w s2 ret.append(w[1]) ret.append ret append w[1] w 1 print(" ".join(map(str, ret))) print " ".join(map(str, ret)) " ".join " " join map(str, ret) map str ret area += s2.pop()[1] s2.pop()[1] area area = i - j i - j area all_area = 0 0 all_area j = s1.pop() s1.pop() j s2 = [] [] s2 s1 = [] [] s1 all_area += area area all_area ret = [len(s2)] [len(s2)] ret _, j = s1.pop() s1.pop() _
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    s1 = []
    s2 = []
    all_area = 0
    
    for i, c in enumerate(input()):
        if c == "\\":
            s1.append([c, i])
        elif c == "/":
            if len(s1) > 0:
                _, j = s1.pop()
                area = i - j
                all_area += area

                while len(s2)>0 and s2[-1][0]>j:
                    area += s2.pop()[1]
                s2.append([j, area])
                
    print(all_area)
    ret = [len(s2)]
    for w in s2:
        ret.append(w[1])
    print(" ".join(map(str, ret)))

