from sys import stdin
from collections import deque

sect = stdin.readline().lstrip("/_").rstrip("\n\\_")
stack = deque()
res = deque()

for i in range(len(sect)):
    if sect[i] == "\\":
        stack.append(i)
    elif sect[i] == "/":
        if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L))

res = [x[1] for x in res]
print(sum(res))
print(len(res), *res) from sys import stdin from collections import deque sect = stdin.readline().lstrip("/_").rstrip("\n\\_") sect stdin.readline().lstrip("/_").rstrip("\n\\_") stdin.readline().lstrip("/_").rstrip stdin.readline().lstrip("/_") stdin.readline().lstrip stdin.readline() stdin.readline stdin readline lstrip "/_" rstrip "\n\\_" stack = deque() stack deque() deque res = deque() res deque() deque for i in range(len(sect)):
    if sect[i] == "\\":
        stack.append(i)
    elif sect[i] == "/":
        if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L)) i range(len(sect)) range len(sect) len sect if sect[i] == "\\":
        stack.append(i)
    elif sect[i] == "/":
        if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L)) sect[i] == "\\" sect[i] sect i "\\" stack.append(i) stack.append stack append i elif sect[i] == "/":
        if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L)) sect[i] == "/" sect[i] sect i "/" if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L)) len(stack) != 0 len(stack) len stack 0 b = stack.pop() b stack.pop() stack.pop stack pop if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L)) len(res) == 0 len(res) len res 0 res.append( (b, i-b) ) res.append res append (b, i-b) b i-b i b elif b > res[-1][0]:
                res.append( (b, i-b) )
             b > res[-1][0] b res[-1][0] [-1] res -1 0 res.append( (b, i-b) ) res.append res append (b, i-b) b i-b i b sum_L = i-b sum_L i-b i b while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                 len(res) != 0 len(res) len res 0 if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                 res[-1][0] > b res[-1][0] [-1] res -1 0 b sum_L += res[-1][1] sum_L res[-1][1] [-1] res -1 1 res.pop() res.pop res pop break res.append((b, sum_L)) res.append res append (b, sum_L) b sum_L x[1] for x in res for x in res x res for x in res x[1] x 1 res = [x[1] for x in res] res [x[1] for x in res] print(sum(res)) print sum(res) sum res print(len(res), *res) print len(res) len res *res res b = stack.pop() stack.pop() b sect = stdin.readline().lstrip("/_").rstrip("\n\\_") stdin.readline().lstrip("/_").rstrip("\n\\_") sect res = [x[1] for x in res] [x[1] for x in res] res res = deque() deque() res sum_L = i-b i-b sum_L stack = deque() deque() stack sum_L += res[-1][1] res[-1][1] sum_L
from sys import stdin
from collections import deque

sect = stdin.readline().lstrip("/_").rstrip("\n\\_")
stack = deque()
res = deque()

for i in range(len(sect)):
    if sect[i] == "\\":
        stack.append(i)
    elif sect[i] == "/":
        if len(stack) != 0:
            b = stack.pop()
            if len(res) == 0:
                res.append( (b, i-b) )
            elif b > res[-1][0]:
                res.append( (b, i-b) )
            else: # 水たまりを結合
                sum_L = i-b
                while len(res) != 0:
                    if res[-1][0] > b:
                    	sum_L += res[-1][1]
                    	res.pop()
                    else:
                    	break

                res.append((b, sum_L))

res = [x[1] for x in res]
print(sum(res))
print(len(res), *res)
