strs = gets.chomp
s1 = []
s2 = []
curr_i = 0
strs.chars do |c|
  curr_i += 1
  if c == "\\"
    s1.push(curr_i)
  elsif c == '/'
    down_i = s1.pop
    next if down_i.nil?

    area = curr_i - down_i
    while s2.last && s2.last[0] > down_i
      area += (s2.pop)[1]
    end
    s2.push([down_i, area])
  end
end

puts s2.sum{|s| s[1]}
puts "#{s2.length} #{s2.map{|s| s[1]}.join(' ')}".strip
