sum = 0
res = []
s = []
x = 0
gets.split("").each_with_index { |v, i|
  if v == "\\"
    s << i
  elsif v == "/"
    j = s.pop()
    if !j.nil?
      a = i - j # index??????????????§?¨???????????¨??????????
      sum += a

      loop do
        k, b = res.pop
        if !k.nil?
          if j < k
            a += b
          else
            res << [k, b]
            break
          end
        else
          break
        end
      end
      res << [j, a]
    end
  end
}
puts sum
puts "#{res.size()} #{res.map{|n| n[1]}.join(" ")}"