from collections import deque



section = eval(input( ))

depth = 0

area = 0

depthArr = deque( )

areaArr = deque( )



for i, ground in enumerate( section ):

	if "\\" == ground:

		depth += 1

		depthArr.append( i )

	elif 0 < depth and "/" == ground:

		if len( depthArr ):

			j = depthArr.pop( )

			pool =  i - j

			area += pool



			while len( areaArr ):

				preJ, prePool = areaArr.pop( )

				if j <= preJ:

					pool += prePool

				else:

					areaArr.append( ( preJ, prePool ) )

					break

			areaArr.append( ( j, pool ) )



print( area )

output = []

output.append( len( areaArr ) )

for arr in areaArr:

	output.append( arr[1] )

print(( " ".join( map( str, output ) ) ))
from collections import deque



section = input( )

area = 0

depthPosArr = deque( )

depthPosPoolArr = deque( )



for ipos, ground in enumerate( section ):

	if "\\" == ground:

		depthPosArr.append( ipos )

	elif "/" == ground:

		if len( depthPosArr ):

			jpos = depthPosArr.pop( )

			pool =  ipos - jpos

			area += pool



			while len( depthPosPoolArr ):

				preJPos, prePool = depthPosPoolArr.pop( )

				if jpos <= preJPos:

					pool += prePool

				else:

					depthPosPoolArr.append( ( preJPos, prePool ) )

					break

			depthPosPoolArr.append( ( jpos, pool ) )



print( area )

output = []

output.append( len( depthPosPoolArr ) )

for arr in depthPosPoolArr:

	output.append( arr[1] )

print(( " ".join( map( str, output ) ) ))
from collections import deque

section = eval(input())
depth = 0
area = 0
depthArr = deque()
areaArr = deque()
for i, ground in enumerate(section):
    if "\\" == ground:
        depth += 1
        depthArr.append(i)
    elif 0 < depth and "/" == ground:
        if len(depthArr):
            j = depthArr.pop()
            pool = i - j
            area += pool
            while len(areaArr):
                preJ, prePool = areaArr.pop()
                if j <= preJ:
                    pool += prePool
                else:
                    areaArr.append((preJ, prePool))
                    break
            areaArr.append((j, pool))
print(area)
output = []
output.append(len(areaArr))
for arr in areaArr:
    output.append(arr[1])
print((" ".join(map(str, output))))

from collections import deque

section = input()
area = 0
depthPosArr = deque()
depthPosPoolArr = deque()
for ipos, ground in enumerate(section):
    if "\\" == ground:
        depthPosArr.append(ipos)
    elif "/" == ground:
        if len(depthPosArr):
            jpos = depthPosArr.pop()
            pool = ipos - jpos
            area += pool
            while len(depthPosPoolArr):
                preJPos, prePool = depthPosPoolArr.pop()
                if jpos <= preJPos:
                    pool += prePool
                else:
                    depthPosPoolArr.append((preJPos, prePool))
                    break
            depthPosPoolArr.append((jpos, pool))
print(area)
output = []
output.append(len(depthPosPoolArr))
for arr in depthPosPoolArr:
    output.append(arr[1])
print((" ".join(map(str, output))))

-section = eval(input()) -depth = 0 +section = input() -depthArr = deque() -areaArr = deque() -for i, ground in enumerate(section): +depthPosArr = deque() +depthPosPoolArr = deque() +for ipos, ground in enumerate(section): -        depth += 1 -        depthArr.append(i) -    elif 0 < depth and "/" == ground: -        if len(depthArr): -            j = depthArr.pop() -            pool = i - j +        depthPosArr.append(ipos) +    elif "/" == ground: +        if len(depthPosArr): +            jpos = depthPosArr.pop() +            pool = ipos - jpos -            while len(areaArr): -                preJ, prePool = areaArr.pop() -                if j <= preJ: +            while len(depthPosPoolArr): +                preJPos, prePool = depthPosPoolArr.pop() +                if jpos <= preJPos: -                    areaArr.append((preJ, prePool)) +                    depthPosPoolArr.append((preJPos, prePool)) -            areaArr.append((j, pool)) +            depthPosPoolArr.append((jpos, pool)) -output.append(len(areaArr)) -for arr in areaArr: +output.append(len(depthPosPoolArr)) +for arr in depthPosPoolArr: