def main(input = input = STDIN.gets)
  input.chomp!

  y = 0
  stack = []

  input.chars.each_with_index do |ch, x|
    # puts "#{ch} (#{x}, #{y})"

    case ch
    when '\\' # DOWN
      y -= 1
      stack << [x, y]
    when '/'  # UP
      area = 0

      until stack.empty? || stack.all?{|e| e.is_a?(Integer)}
        case stack[-1]
        when Integer
          area += stack.pop
        when Array
          last_x, _ = stack.pop
          area += x - last_x
          break
        end
      end
      stack << area unless area.zero?

      y += 1
    when '_'
      # skip
    end
  end

  areas = stack.select{|e| e.is_a?(Integer) }

  puts areas.sum
  puts [areas.length, *areas].join ' '
end

main
