from collections import deque

section = raw_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 = raw_input( ) section raw_input( ) raw_input depth = 0 depth 0 area = 0 area 0 depthArr = deque( ) depthArr deque( ) deque areaArr = deque( ) areaArr deque( ) 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 ) ) i ground enumerate( section ) 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 ) ) "\\" == ground "\\" ground depth += 1 depth 1 depthArr.append( i ) depthArr.append 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 ) ) 0 < depth and "/" == ground 0 < depth 0 depth "/" == ground "/" 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 ) ) len( depthArr ) len depthArr j = depthArr.pop( ) j depthArr.pop( ) depthArr.pop depthArr pop pool =  i - j pool i - j i j area += pool area pool while len( areaArr ):
				preJ, prePool = areaArr.pop( )
				if j <= preJ:
					pool += prePool
				else:
					areaArr.append( ( preJ, prePool ) )
					break
			 len( areaArr ) len areaArr preJ, prePool = areaArr.pop( ) preJ areaArr.pop( ) areaArr.pop areaArr pop prePool if j <= preJ:
					pool += prePool
				else:
					areaArr.append( ( preJ, prePool ) )
					break
			 j <= preJ j preJ pool += prePool pool prePool areaArr.append( ( preJ, prePool ) ) areaArr.append areaArr append ( preJ, prePool ) preJ prePool break areaArr.append( ( j, pool ) ) areaArr.append areaArr append ( j, pool ) j pool print( area ) print area output = [] output [] output.append( len( areaArr ) ) output.append output append len( areaArr ) len areaArr for arr in areaArr:
	output.append( arr[1] ) arr areaArr output.append( arr[1] ) output.append output append arr[1] arr 1 print( " ".join( map( str, output ) ) ) print " ".join( map( str, output ) ) " ".join " " join map( str, output ) map str output depthArr = deque( ) deque( ) depthArr depth = 0 0 depth pool =  i - j i - j pool output = [] [] output pool += prePool prePool pool prePool = areaArr.pop( ) areaArr.pop( ) prePool areaArr = deque( ) deque( ) areaArr section = raw_input( ) raw_input( ) section area = 0 0 area area += pool pool area preJ, prePool = areaArr.pop( ) areaArr.pop( ) preJ depth += 1 1 depth j = depthArr.pop( ) depthArr.pop( ) j
from collections import deque

section = raw_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 ) ) )