# -*- coding: utf-8 -*-

count = 0
backslash_index = []
area_pond = []
pending_area=[]
for index,symbol in enumerate(input()):
	if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff]

print(count)
print(len(area_pond),*(pending_area))
#print(len(area_pond), ' '.join(map(str, pending_area)))
 count = 0 count 0 backslash_index = [] backslash_index [] area_pond = [] area_pond [] pending_area=[] pending_area [] for index,symbol in enumerate(input()):
	if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff] index symbol enumerate(input()) enumerate input() input if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff] symbol == "\\" symbol "\\" backslash_index += [index] backslash_index [index] index elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff] symbol == '/' and backslash_index symbol == '/' symbol '/' backslash_index last_bs_index = backslash_index.pop() last_bs_index backslash_index.pop() backslash_index.pop backslash_index pop diff = index - last_bs_index diff index - last_bs_index index last_bs_index count += diff count diff while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		 area_pond and area_pond[-1] > last_bs_index area_pond area_pond[-1] > last_bs_index area_pond[-1] area_pond -1 last_bs_index diff += pending_area.pop() diff pending_area.pop() pending_area.pop pending_area pop area_pond.pop() area_pond.pop area_pond pop area_pond += [last_bs_index] area_pond [last_bs_index] last_bs_index pending_area += [diff] pending_area [diff] diff print(count) print count print(len(area_pond),*(pending_area)) print len(area_pond) len area_pond *(pending_area) pending_area count = 0 0 count count += diff diff count diff += pending_area.pop() pending_area.pop() diff backslash_index = [] [] backslash_index last_bs_index = backslash_index.pop() backslash_index.pop() last_bs_index area_pond += [last_bs_index] [last_bs_index] area_pond backslash_index += [index] [index] backslash_index area_pond = [] [] area_pond pending_area += [diff] [diff] pending_area pending_area=[] [] pending_area diff = index - last_bs_index index - last_bs_index diff
# -*- coding: utf-8 -*-

count = 0
backslash_index = []
area_pond = []
pending_area=[]
for index,symbol in enumerate(input()):
	if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff]

print(count)
print(len(area_pond),*(pending_area))
#print(len(area_pond), ' '.join(map(str, pending_area)))

