import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    t = input().strip()
    s = []
    # A = 0
    ans = []
    prevA = 0
    for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

    v = 0
    for i in range(len(ans)):
        v += ans[i][1]
    print(v)
    print(len(ans), end='')
    for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
    print('')

if __name__ == '__main__':
    main()
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from operator import itemgetter sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 INF = 10**30 INF 10**30 10 30 def main():
    t = input().strip()
    s = []
    # A = 0
    ans = []
    prevA = 0
    for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

    v = 0
    for i in range(len(ans)):
        v += ans[i][1]
    print(v)
    print(len(ans), end='')
    for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
    print('') main t = input().strip() t input().strip() ().strip () input strip s = [] s [] ans = [] ans [] prevA = 0 prevA 0 for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

     i range(len(t)) range len(t) len t if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

     t[i] == '\\' t[i] t i '\\' s.append(i) s.append s append i elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

     len(s) > 0 and t[i] == '/' len(s) > 0 len(s) len s 0 t[i] == '/' t[i] t i '/' p = s.pop() p s.pop() s.pop s pop k = i - p k i - p i p ans.append((p, k)) ans.append ans append (p, k) p k q = 0 q 0 while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
             len(ans) > 0 len(ans) len ans 0 g, h = ans[-1] g ans[-1] ans -1 h if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
             g >= p g p q += h q h ans.pop() ans.pop ans pop break if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

     q != 0 q 0 ans.append((p, q)) ans.append ans append (p, q) p q v = 0 v 0 for i in range(len(ans)):
        v += ans[i][1]
     i range(len(ans)) range len(ans) len ans v += ans[i][1] v ans[i][1] [i] ans i 1 print(v) print v print(len(ans), end='') print len(ans) len ans end='' end '' for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
     i range(len(ans)) range len(ans) len ans print(' {}'.format(ans[i][1]), end='') print ' {}'.format(ans[i][1]) ' {}'.format ' {}' format ans[i][1] [i] ans i 1 end='' end '' print('') print '' if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    t = input().strip()
    s = []
    # A = 0
    ans = []
    prevA = 0
    for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

    v = 0
    for i in range(len(ans)):
        v += ans[i][1]
    print(v)
    print(len(ans), end='')
    for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
    print('') def main():
    t = input().strip()
    s = []
    # A = 0
    ans = []
    prevA = 0
    for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

    v = 0
    for i in range(len(ans)):
        v += ans[i][1]
    print(v)
    print(len(ans), end='')
    for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
    print('') main INF = 10**30 10**30 INF input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    t = input().strip()
    s = []
    # A = 0
    ans = []
    prevA = 0
    for i in range(len(t)):
        if t[i] == '\\':
            s.append(i)
        elif len(s) > 0 and t[i] == '/':
            p = s.pop()
            k = i - p
            ans.append((p, k))
            q = 0
            while len(ans) > 0:
                # print(ans)
                g, h = ans[-1]
                if g >= p:
                    q += h
                    ans.pop()
                else:
                    break
            # for j in range(len(ans) - len(s)):
            #     print('i: ', i)
            #     print('j: ', j)
            #     print('ans: ', ans)
            #     q += ans.pop()
                # print('q: ', q)
            if q != 0:
                ans.append((p, q))
        # elif len(s) > 0 and t[i] == '_':
        #     A += 1

    v = 0
    for i in range(len(ans)):
        v += ans[i][1]
    print(v)
    print(len(ans), end='')
    for i in range(len(ans)):
        print(' {}'.format(ans[i][1]), end='')
    print('')

if __name__ == '__main__':
    main()

