s = []
log = []
l = gets.chomp.split("")
sum = 0
for i in 0..l.size-1 do
  c = l[i]
  if c=="\\"
    s.push(i)
  elsif c=="/" && s.size>0
    right,left = i,s.pop
    sum += right - left
    log << [left,right]
  end
end
printf("%d\n",sum)

log = log.sort_by{|left,right| left }
edge = nil
sum = 0
flood = [0]
edge = log[0][1]
for i in 0..log.size-1 do
  left,right = log[i]
  if edge && edge < left
    flood << sum
    flood[0] += 1
    sum = 0
    edge = right
  end
  sum += right - left
  if i == log.size-1
    flood << sum
    flood[0] += 1
  end
end
printf("%s\n",flood.join(" "))
