import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    s = input()

    stack = []
    flat_pools = []
    for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

    flat_pools.sort(key=lambda pool: pool[0])

    last_index = 0
    pools = []
    area = 0

    for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

    pools.insert(0, len(pools))
    print(area)
    print(" ".join(map(str, pools)))


if __name__ == '__main__':
    main()
 import math math import string string import itertools itertools import fractions fractions import heapq heapq import collections collections import re re import array array import bisect bisect import sys sys import random random import time time inf = 10**9 inf 10**9 10 9 def main():
    s = input()

    stack = []
    flat_pools = []
    for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

    flat_pools.sort(key=lambda pool: pool[0])

    last_index = 0
    pools = []
    area = 0

    for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

    pools.insert(0, len(pools))
    print(area)
    print(" ".join(map(str, pools))) main s = input() s input() input stack = [] stack [] flat_pools = [] flat_pools [] for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

     (i, c) i c enumerate(s) enumerate s if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

     c == '\\' c '\\' stack.append(i) stack.append stack append i elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

     c == '/' and len(stack) > 0 c == '/' c '/' len(stack) > 0 len(stack) len stack 0 flat_pools.append((stack.pop(), i)) flat_pools.append flat_pools append (stack.pop(), i) stack.pop() stack.pop stack pop i flat_pools.sort(key=lambda pool: pool[0]) flat_pools.sort flat_pools sort key=lambda pool: pool[0] key lambda pool: pool[0] pool[0] pool 0 pool last_index = 0 last_index 0 pools = [] pools [] area = 0 area 0 for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

     pool flat_pools area += pool[1] - pool[0] area pool[1] - pool[0] pool[1] pool 1 pool[0] pool 0 if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

     last_index <= pool[0] last_index pool[0] pool 0 pools.append(pool[1] - pool[0]) pools.append pools append pool[1] - pool[0] pool[1] pool 1 pool[0] pool 0 last_index = pool[1] last_index pool[1] pool 1 pools[-1] = pools[-1] + pool[1] - pool[0] pools[-1] pools -1 pools[-1] + pool[1] - pool[0] pools[-1] + pool[1] pools[-1] pools -1 pool[1] pool 1 pool[0] pool 0 pools.insert(0, len(pools)) pools.insert pools insert 0 len(pools) len pools print(area) print area print(" ".join(map(str, pools))) print " ".join(map(str, pools)) " ".join " " join map(str, pools) map str pools if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main inf = 10**9 10**9 inf def main():
    s = input()

    stack = []
    flat_pools = []
    for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

    flat_pools.sort(key=lambda pool: pool[0])

    last_index = 0
    pools = []
    area = 0

    for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

    pools.insert(0, len(pools))
    print(area)
    print(" ".join(map(str, pools))) def main():
    s = input()

    stack = []
    flat_pools = []
    for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

    flat_pools.sort(key=lambda pool: pool[0])

    last_index = 0
    pools = []
    area = 0

    for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

    pools.insert(0, len(pools))
    print(area)
    print(" ".join(map(str, pools))) main
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    s = input()

    stack = []
    flat_pools = []
    for (i, c) in enumerate(s):
        if c == '\\':
            stack.append(i)
        elif c == '/' and len(stack) > 0:
            flat_pools.append((stack.pop(), i))

    flat_pools.sort(key=lambda pool: pool[0])

    last_index = 0
    pools = []
    area = 0

    for pool in flat_pools:
        area += pool[1] - pool[0]
        if last_index <= pool[0]:
            pools.append(pool[1] - pool[0])
            last_index = pool[1]
        else:
            pools[-1] = pools[-1] + pool[1] - pool[0]

    pools.insert(0, len(pools))
    print(area)
    print(" ".join(map(str, pools)))


if __name__ == '__main__':
    main()

