import sys
from collections import deque

def test():

	EleList = deque()
	sublist = []
	output = []
	areas_from_left = list(sys.stdin.readline())
	sum = 0
	depth = 0

	for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	output_sublist = []
	for tmp in sublist:
		output_sublist.append(tmp[0])

	output = output + output_sublist
	length = len(output)

	print(sum)
	if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	for i in range(length - 1):
		print(f"{output[i]} ",end='')
	if output:
		print(output[length-1])

if __name__ == "__main__":
	test() import sys sys from collections import deque def test():

	EleList = deque()
	sublist = []
	output = []
	areas_from_left = list(sys.stdin.readline())
	sum = 0
	depth = 0

	for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	output_sublist = []
	for tmp in sublist:
		output_sublist.append(tmp[0])

	output = output + output_sublist
	length = len(output)

	print(sum)
	if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	for i in range(length - 1):
		print(f"{output[i]} ",end='')
	if output:
		print(output[length-1]) test EleList = deque() EleList deque() deque sublist = [] sublist [] output = [] output [] areas_from_left = list(sys.stdin.readline()) areas_from_left list(sys.stdin.readline()) list sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline sum = 0 sum 0 depth = 0 depth 0 for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 element areas_from_left if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 element == '\\' element '\\' depth += 1 depth 1 EleList.append(element) EleList.append EleList append element elif element == '_':
			if EleList:
				EleList.append(element)

		 element == '_' element '_' if EleList:
				EleList.append(element)

		 EleList EleList.append(element) EleList.append EleList append element elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 element == '/' element '/' depth -= 1 depth 1 if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 EleList for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				 pop_count range(len(EleList)) range len(EleList) len EleList pop_ele = EleList.pop() pop_ele EleList.pop() EleList.pop EleList pop if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				 pop_ele == '\\' and EleList pop_ele == '\\' pop_ele '\\' EleList for i in range(pop_count+2):
							EleList.append('_')
						 i range(pop_count+2) range pop_count+2 pop_count 2 EleList.append('_') EleList.append EleList append '_' break lake = pop_count + 1 lake pop_count + 1 pop_count 1 sum += lake sum lake if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 len(EleList) == 0 len(EleList) len EleList 0 if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				 len(sublist) == 0 len(sublist) len sublist 0 output.append(lake) output.append output append lake tmp = 0 tmp 0 for i in sublist:
							tmp += i[0]
						 i sublist tmp += i[0] tmp i[0] i 0 output.append(tmp + lake) output.append output append tmp + lake tmp lake sublist.clear() sublist.clear sublist clear if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	 not sublist or sublist[len(sublist)-1][1] < depth not sublist sublist sublist[len(sublist)-1][1] < depth sublist[len(sublist)-1][1] [len(sublist)-1] sublist len(sublist)-1 len(sublist) len sublist 1 1 depth sublist_element = [0,0] sublist_element [0,0] 0 0 sublist_element[0] = lake sublist_element[0] sublist_element 0 lake sublist_element[1] = depth sublist_element[1] sublist_element 1 depth sublist.append(sublist_element) sublist.append sublist append sublist_element sublist_element = [lake,depth] sublist_element [lake,depth] lake depth while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						 True if not sublist:
								break

							 not sublist sublist break tmp = sublist.pop() tmp sublist.pop() sublist.pop sublist pop if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						 tmp[1] > depth tmp[1] tmp 1 depth sublist_element[0] += tmp[0] sublist_element[0] sublist_element 0 tmp[0] tmp 0 sublist.append(tmp) sublist.append sublist append tmp break sublist.append(sublist_element) sublist.append sublist append sublist_element output_sublist = [] output_sublist [] for tmp in sublist:
		output_sublist.append(tmp[0])

	 tmp sublist output_sublist.append(tmp[0]) output_sublist.append output_sublist append tmp[0] tmp 0 output = output + output_sublist output output + output_sublist output output_sublist length = len(output) length len(output) len output print(sum) print sum if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	 length != 0 length 0 print(f"{length} ",end='') print f"{length} " end='' end '' print(length) print length for i in range(length - 1):
		print(f"{output[i]} ",end='')
	 i range(length - 1) range length - 1 length 1 print(f"{output[i]} ",end='') print f"{output[i]} " end='' end '' if output:
		print(output[length-1]) output print(output[length-1]) print output[length-1] output length-1 length 1 if __name__ == "__main__":
	test() __name__ == "__main__" __name__ "__main__" test() test def test():

	EleList = deque()
	sublist = []
	output = []
	areas_from_left = list(sys.stdin.readline())
	sum = 0
	depth = 0

	for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	output_sublist = []
	for tmp in sublist:
		output_sublist.append(tmp[0])

	output = output + output_sublist
	length = len(output)

	print(sum)
	if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	for i in range(length - 1):
		print(f"{output[i]} ",end='')
	if output:
		print(output[length-1]) def test():

	EleList = deque()
	sublist = []
	output = []
	areas_from_left = list(sys.stdin.readline())
	sum = 0
	depth = 0

	for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	output_sublist = []
	for tmp in sublist:
		output_sublist.append(tmp[0])

	output = output + output_sublist
	length = len(output)

	print(sum)
	if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	for i in range(length - 1):
		print(f"{output[i]} ",end='')
	if output:
		print(output[length-1]) test
import sys
from collections import deque

def test():

	EleList = deque()
	sublist = []
	output = []
	areas_from_left = list(sys.stdin.readline())
	sum = 0
	depth = 0

	for element in areas_from_left:

		if element == '\\':
			depth += 1
			EleList.append(element)

		elif element == '_':
			if EleList:
				EleList.append(element)

		elif element == '/':
			depth -= 1
			if EleList:
				for pop_count in range(len(EleList)):
				
					pop_ele = EleList.pop()
					if pop_ele == '\\' and EleList:
						for i in range(pop_count+2):
							EleList.append('_')
						break
				lake = pop_count + 1
				sum += lake

				if len(EleList) == 0:
					if len(sublist) == 0:
						output.append(lake)
					else:
						tmp = 0
						for i in sublist:
							tmp += i[0]
						output.append(tmp + lake)
						sublist.clear()
				else:
					
					if not sublist or sublist[len(sublist)-1][1] < depth:
						sublist_element = [0,0]
						sublist_element[0] = lake
						sublist_element[1] = depth
						sublist.append(sublist_element)
					
					else:

						sublist_element = [lake,depth]

						while True:
							
							if not sublist:
								break

							tmp = sublist.pop()
							if tmp[1] > depth:
								sublist_element[0] += tmp[0]
							else:
								sublist.append(tmp)
								break

						sublist.append(sublist_element)
				#print(f"{output}{sublist}")

	output_sublist = []
	for tmp in sublist:
		output_sublist.append(tmp[0])

	output = output + output_sublist
	length = len(output)

	print(sum)
	if length != 0:
		print(f"{length} ",end='')
	else:
		print(length)
	

	for i in range(length - 1):
		print(f"{output[i]} ",end='')
	if output:
		print(output[length-1])

if __name__ == "__main__":
	test()
