input = gets.chomp.split ''
stack1 = []
stack2 = []
answer = 0

input.each_with_index do |char, index|
  stack1 << index if char == '\\'
  next unless char == '/' && !stack1.empty?
  j = stack1.pop
  a = index - j
  answer += a
  a += stack2.pop[1] while !stack2.empty? && stack2[-1][0] > j
  stack2 << [j, a]
end

puts answer
areas = []
stack2.each do |array|
  areas << array[1]
end
result = [areas.size].concat(areas)
puts result.join ' '

