from collections import deque

section = raw_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 = raw_input( ) section raw_input( ) raw_input area = 0 area 0 depthPosArr = deque( ) depthPosArr deque( ) deque depthPosPoolArr = deque( ) depthPosPoolArr deque( ) 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 ) ) ipos ground enumerate( section ) 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 ) ) "\\" == ground "\\" ground depthPosArr.append( ipos ) depthPosArr.append 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 ) ) "/" == ground "/" 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 ) ) len( depthPosArr ) len depthPosArr jpos = depthPosArr.pop( ) jpos depthPosArr.pop( ) depthPosArr.pop depthPosArr pop pool =  ipos - jpos pool ipos - jpos ipos jpos area += pool area pool while len( depthPosPoolArr ):
				preJPos, prePool = depthPosPoolArr.pop( )
				if jpos <= preJPos:
					pool += prePool
				else:
					depthPosPoolArr.append( ( preJPos, prePool ) )
					break
			 len( depthPosPoolArr ) len depthPosPoolArr preJPos, prePool = depthPosPoolArr.pop( ) preJPos depthPosPoolArr.pop( ) depthPosPoolArr.pop depthPosPoolArr pop prePool if jpos <= preJPos:
					pool += prePool
				else:
					depthPosPoolArr.append( ( preJPos, prePool ) )
					break
			 jpos <= preJPos jpos preJPos pool += prePool pool prePool depthPosPoolArr.append( ( preJPos, prePool ) ) depthPosPoolArr.append depthPosPoolArr append ( preJPos, prePool ) preJPos prePool break depthPosPoolArr.append( ( jpos, pool ) ) depthPosPoolArr.append depthPosPoolArr append ( jpos, pool ) jpos pool print( area ) print area output = [] output [] output.append( len( depthPosPoolArr ) ) output.append output append len( depthPosPoolArr ) len depthPosPoolArr for arr in depthPosPoolArr:
	output.append( arr[1] ) arr depthPosPoolArr 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 depthPosPoolArr = deque( ) deque( ) depthPosPoolArr jpos = depthPosArr.pop( ) depthPosArr.pop( ) jpos output = [] [] output prePool = depthPosPoolArr.pop( ) depthPosPoolArr.pop( ) prePool section = raw_input( ) raw_input( ) section area = 0 0 area preJPos, prePool = depthPosPoolArr.pop( ) depthPosPoolArr.pop( ) preJPos depthPosArr = deque( ) deque( ) depthPosArr pool += prePool prePool pool area += pool pool area pool =  ipos - jpos ipos - jpos pool
from collections import deque

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