def ALDS1_3D():
    s0, s1 = [], []
    for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

    ss = [s[1] for s in s1]
    print(sum(ss))
    print(len(ss), *ss)





if __name__ == '__main__':
    ALDS1_3D() def ALDS1_3D():
    s0, s1 = [], []
    for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

    ss = [s[1] for s in s1]
    print(sum(ss))
    print(len(ss), *ss) ALDS1_3D s0, s1 = [], [] s0 [] s1 [] for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

     i e enumerate(input()) enumerate input() input if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

     e == '\\' e '\\' s0.append(i) s0.append s0 append i elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

     e == '/' e '/' if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

     len(s0) > 0 len(s0) len s0 0 j = s0.pop() j s0.pop() s0.pop s0 pop s = i - j s i - j i j while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                 len(s1) > 0 and j < s1[-1][0] len(s1) > 0 len(s1) len s1 0 j < s1[-1][0] j s1[-1][0] [-1] s1 -1 0 s += s1[-1][1] s s1[-1][1] [-1] s1 -1 1 s1.pop() s1.pop s1 pop s1.append((j, s)) s1.append s1 append (j, s) j s s[1] for s in s1 for s in s1 s s1 for s in s1 s[1] s 1 ss = [s[1] for s in s1] ss [s[1] for s in s1] print(sum(ss)) print sum(ss) sum ss print(len(ss), *ss) print len(ss) len ss *ss ss if __name__ == '__main__':
    ALDS1_3D() __name__ == '__main__' __name__ '__main__' ALDS1_3D() ALDS1_3D def ALDS1_3D():
    s0, s1 = [], []
    for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

    ss = [s[1] for s in s1]
    print(sum(ss))
    print(len(ss), *ss) def ALDS1_3D():
    s0, s1 = [], []
    for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

    ss = [s[1] for s in s1]
    print(sum(ss))
    print(len(ss), *ss) ALDS1_3D
def ALDS1_3D():
    s0, s1 = [], []
    for i, e in enumerate(input()):
        if e == '\\':
                s0.append(i)
        elif e == '/':
            if len(s0) > 0:
                j = s0.pop()
                s = i - j
                while len(s1) > 0 and j < s1[-1][0]:
                    s += s1[-1][1]
                    s1.pop()
                s1.append((j, s))

    ss = [s[1] for s in s1]
    print(sum(ss))
    print(len(ss), *ss)





if __name__ == '__main__':
    ALDS1_3D()