require "pp"

input = gets.chomp
chikei = input.split("")

stack1 = []
stack2 =[]
Area = Struct.new(:j,:area)
i = 0
j = 0

all_area = 0
while chikei.size >= (i - 1)
	i += 1
	if chikei[i-1] == "\\" then
		stack1.push i
	elsif chikei[i-1] == "/" then
		if stack1.size > 0 then
			j = stack1.pop
			all_area = all_area + (i - j)
			area = i - j
			if stack2.size > 0 then
				while stack2.size > 0 && j <  stack2.last[:j] 
					area = area + stack2.last[:area]
					stack2.pop
				end
			end
			areas= {j: j, area: area}
			stack2.push areas
		end
	end
end
p all_area
print stack2.size
while stack2.size > 0
	print " " + stack2.first[:area].to_s 
	stack2.shift
end