def AddDepth(list, hash, depth, index)
	list[index] = depth
	hash[depth] = Array.new if hash[depth] == nil
	hash[depth] << index
end

mapstr = gets.chomp

list_depth = Array.new(mapstr.length, nil)
hash_depth = Array.new(mapstr.length*2, nil)
depth = 0

mapstr.length.times { |i|
	case mapstr[i]
	when "\\"
		depth -= 1
		AddDepth(list_depth, hash_depth, depth, i)
	when "/"
		AddDepth(list_depth, hash_depth, depth, i)
		depth += 1
	when "_"
		AddDepth(list_depth, hash_depth, depth, i)
	end
}

#=============================================================================

list_lakeregion = Array.new
i = 0
while i < mapstr.length
	if mapstr[i] == "\\"
		depth_i = list_depth[i]
		hash_depth[depth_i].each { |di|
			nextloop = false
			if i == di
				hash_depth[depth_i].each { |ei|
					next if mapstr[ei] != "/" or ei <= di 

					list_lakeregion << (di..ei)
					i = ei if ei != nil
					nextloop = true
					break
				}
				break if nextloop
			end
		}
	end
	i += 1
end

#======================================================================

list_area = Array.new

list_lakeregion.each { |r|
	area = 0
	zero_depth = list_depth[r.first] + 1
	r.each { |i|
		depth = zero_depth - list_depth[i]
		case mapstr[i]
		when "\\","/"
			depth -= 0.5
		end
		area += depth
	}
	list_area << area
}

puts list_area.inject(:+).to_i
print list_lakeregion.length
list_area.each { |a| print " #{a.to_i}" }
puts