def main():
    a = 0
    i = 0
    s = []
    u = []
    l = raw_input()
    for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
    u.insert(0, (0, len(u)))

    print(a)
    print(' '.join(map(lambda x: str(x[1]), u)))


if __name__ == '__main__':
    main() def main():
    a = 0
    i = 0
    s = []
    u = []
    l = raw_input()
    for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
    u.insert(0, (0, len(u)))

    print(a)
    print(' '.join(map(lambda x: str(x[1]), u))) main a = 0 a 0 i = 0 i 0 s = [] s [] u = [] u [] l = raw_input() l raw_input() raw_input for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
     c l if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
         c == '\\' c '\\' s.append(i) s.append s append i elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
         c == '/' and len(s) > 0 c == '/' c '/' len(s) > 0 len(s) len s 0 j = s.pop() j s.pop() s.pop s pop t = i - j t i - j i j a += t a t while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
             len(u) > 0 and u[-1][0] > j len(u) > 0 len(u) len u 0 u[-1][0] > j u[-1][0] [-1] u -1 0 j t += u.pop()[1] t u.pop()[1] u.pop() u.pop u pop 1 u.append((j, t)) u.append u append (j, t) j t i += 1 i 1 u.insert(0, (0, len(u))) u.insert u insert 0 (0, len(u)) 0 len(u) len u print(a) print a print(' '.join(map(lambda x: str(x[1]), u))) print ' '.join(map(lambda x: str(x[1]), u)) ' '.join ' ' join map(lambda x: str(x[1]), u) map lambda x: str(x[1]) str(x[1]) str x[1] x 1 x u if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a = 0
    i = 0
    s = []
    u = []
    l = raw_input()
    for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
    u.insert(0, (0, len(u)))

    print(a)
    print(' '.join(map(lambda x: str(x[1]), u))) def main():
    a = 0
    i = 0
    s = []
    u = []
    l = raw_input()
    for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
    u.insert(0, (0, len(u)))

    print(a)
    print(' '.join(map(lambda x: str(x[1]), u))) main
def main():
    a = 0
    i = 0
    s = []
    u = []
    l = raw_input()
    for c in l:
        if c == '\\':
            s.append(i)
        elif c == '/' and len(s) > 0:
            j = s.pop()
            t = i - j
            a += t
            while len(u) > 0 and u[-1][0] > j:
                t += u.pop()[1]
            u.append((j, t))
        i += 1
    u.insert(0, (0, len(u)))

    print(a)
    print(' '.join(map(lambda x: str(x[1]), u)))


if __name__ == '__main__':
    main()