input = gets.chomp.chars
stack = []
pairs = []
input.each_with_index do |char, i|
	case char
	when "\\"
		stack << i
	when "/"
		if not stack.empty?
			pairs << [stack.pop, i]
		end
	end
end

#display sum
puts pairs.inject(0){|sum, pair| sum += pair[1] - pair[0]}

#group pairs into puddles
pairs.sort!
puddles = [[pairs.shift]]
pairs.each do |pair|
	if pair[1] < puddles[-1][0][1] 
		puddles[-1] << pair
	else
		puddles << [pair]
	end
end

#display puddles
print puddles.size
puddles.each do |puddle|
	print " #{puddle.inject(0){|sum, pair| sum += pair[1] - pair[0]}}"
end
print "\n"