def additable_flood?(after_sections, dup)
  sim_dup = 0
  after_sections.size.times do |i|
    case after_sections[i]
    when '\\'
      sim_dup -= 1
    when '/'
      sim_dup += 1
      return false if sim_dup > 0
    end
  end

  true
end

sections = gets
down_steps = []
floods = []
area = 0
step = 0
dup = 0

sections.size.times do |i|
  step += 1
  case sections[i]
  when '\\'
    down_steps << step
    dup += 1

  when '/'
    if down_steps != []
      ds = down_steps.pop
      area += step - ds
      dup -= 1

      if dup != 0 && additable_flood?(sections[i+1..-1], dup)
        floods << area
        area = 0
        down_step = []
        step = 0
        next
      end
    end
  end

  if (dup == 0 && area != 0)
    floods << area
    area = 0
    down_step = []
    step = 0
  end
end

floods << area if area != 0

puts floods.sum
floods.size != 0 ? puts("#{floods.size} #{floods.join(' ')}") : puts('0')
