def calc_area a
  l = a.length
  t = a[0]
  ls = Array.new
  s = 0
  for i in 1...l
    if a[i-1] == a[i]
      s += (t - a[i]) * 2
    elsif a[i-1] < a[i]
      s += (t - a[i]) * 2 + 1
    else
      s += (t - a[i]) * 2 - 1
    end
    if a[i] == t && s != 0
      ls.push(s/2)
      s = 0
    end
  end
  ls
end

def split_map a
  n = a.length
  t = a.max
  t -= 1 while t != a.min && (l = a.index(t)) == (r = a.rindex(t))
  area = []
  if l != r
    area.concat(split_map a[0,l]) if l > 0
    area.concat(calc_area a[l,r-l+1])
    area.concat(split_map a[r+1,n-r]) if r < n-1
  end
  area
end

h = 0
a = Array.new
a.push 0
s = gets.chomp
l = s.length
for i in 0...l
  case s[i]
  when "\\"
    h -= 1
    a.push h
  when "/"
    h += 1
    a.push h
  when "_"
    a.push h
  end
end
b = a.min
a.map! {|n| n -= b}
ls = split_map a
n = ls.length
t = 0
for i in 0...n
  t += ls[i]
end
puts t
ls.unshift(ls.length)
puts ls.join(" ")