class Pool
  def initialize(s, e)
    @s, @e = s, e
    @area = 0
  end

  def ==(other)
    @s == other.s && @e == other.e && @area == other.area
  end

  attr_accessor :s, :e, :area
end

terrain = gets.chomp
rex = Regexp.new(/\\_*\//)
pools = []
loop do
  pairs = terrain.scan(rex)
  break if pairs.size == 0
  pairs.each {|p|
    s = terrain.index(p)
    e = s + p.size - 1
    children = pools.select{|x| s < x.s && x.e < e}
    pool = Pool.new s, e
    pool.s = s
    pool.e = e
    if children.size > 0
      pool.area += children.map(&:area).inject(:+)
      pools -= children
    end
    pool.area += p.size - 1
    terrain[s, p.size] = "_" * p.size
    pools << pool
  }
end

puts pools.map{|p| p.area}.inject(:+)
puts "#{pools.size} #{pools.sort_by!(&:s).map(&:area).join(" ")}"