def main(input = $stdin)
  str = input.gets.chomp.split(//)
  stack = Array.new
  lake_size = Array.new(1, 0)
  height = 0
  str.each{|char|
    case char
    when '\\'
      height += 1
      stack.push char
    when '/'
      if height != 0
        width = 1
        while case temp = stack.pop
              when '\\'
                stack.push width + 1
                lake_size.push(lake_size.pop + width)
                lake_size.push 0                
                false
              when Integer
                width += temp
                lake_size.push(lake_size.pop + lake_size.pop)
              else
                width += 1
              end
        end
        height -= 1
      end
    else
      stack.push char
    end
  }
  lake_size.pop
  puts lake_size.reduce(&:+)
  puts lake_size.size.to_s + " " + lake_size.join(" ")
end
File.open('data'){|f|main(f)}