from collections import deque


def main():
    sequence = input()
    stack = deque()
    pools = deque()
    for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
    length = str(len(pools))
    results = list(map(lambda x: x[0], pools))
    print(sum(results))
    print(' '.join([length] + [str(r) for r in results]))


if __name__ == '__main__':
    main()
 from collections import deque def main():
    sequence = input()
    stack = deque()
    pools = deque()
    for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
    length = str(len(pools))
    results = list(map(lambda x: x[0], pools))
    print(sum(results))
    print(' '.join([length] + [str(r) for r in results])) main sequence = input() sequence input() input stack = deque() stack deque() deque pools = deque() pools deque() deque for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
     i e enumerate(sequence) enumerate sequence if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
     e == '\\' e '\\' stack.append(i) stack.append stack append i elif e == '_':
            continue
         e == '_' e '_' continue if len(stack) == 0:
                continue
             len(stack) == 0 len(stack) len stack 0 continue pre = stack.pop() pre stack.pop() stack.pop stack pop s = 0 s 0 while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
             len(pools) > 0 and pre < pools[-1][1] len(pools) > 0 len(pools) len pools 0 pre < pools[-1][1] pre pools[-1][1] [-1] pools -1 1 tmp = pools.pop() tmp pools.pop() pools.pop pools pop s += tmp[0] s tmp[0] tmp 0 pools.append((s + i - pre, i)) pools.append pools append (s + i - pre, i) s + i - pre s + i s i pre i length = str(len(pools)) length str(len(pools)) str len(pools) len pools results = list(map(lambda x: x[0], pools)) results list(map(lambda x: x[0], pools)) list map(lambda x: x[0], pools) map lambda x: x[0] x[0] x 0 x pools print(sum(results)) print sum(results) sum results str(r) for r in results for r in results r results for r in results str(r) str r print(' '.join([length] + [str(r) for r in results])) print ' '.join([length] + [str(r) for r in results]) ' '.join ' ' join [length] + [str(r) for r in results] [length] length [str(r) for r in results] if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    sequence = input()
    stack = deque()
    pools = deque()
    for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
    length = str(len(pools))
    results = list(map(lambda x: x[0], pools))
    print(sum(results))
    print(' '.join([length] + [str(r) for r in results])) def main():
    sequence = input()
    stack = deque()
    pools = deque()
    for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
    length = str(len(pools))
    results = list(map(lambda x: x[0], pools))
    print(sum(results))
    print(' '.join([length] + [str(r) for r in results])) main
from collections import deque


def main():
    sequence = input()
    stack = deque()
    pools = deque()
    for i, e in enumerate(sequence):
        if e == '\\':
            stack.append(i)
        elif e == '_':
            continue
        else:
            if len(stack) == 0:
                continue
            pre = stack.pop()
            s = 0
            while len(pools) > 0 and pre < pools[-1][1]:
                tmp = pools.pop()
                s += tmp[0]
            pools.append((s + i - pre, i))
    length = str(len(pools))
    results = list(map(lambda x: x[0], pools))
    print(sum(results))
    print(' '.join([length] + [str(r) for r in results]))


if __name__ == '__main__':
    main()

