input = gets
sum_areas = []
local_areas = []
sum = 0

input.each_char.with_index do |c, index|
  if c == "\\"
    sum_areas.push(index)
  elsif c == "/" && sum_areas.size > 0
    j = sum_areas.pop
    sum += index - j
    a = index - j
    while(local_areas.size > 0 && local_areas.last[:index] > j)
      a += local_areas.last[:area]
      local_areas.pop
    end
    local_areas.push({ index: j, area: a })
  end
end

puts sum
areas = local_areas.map { |l| l[:area] }.join(' ')
if areas.length > 0
  puts local_areas.size.to_s + " " + areas
else
  puts local_areas.size.to_s
end

