high_water_marks = {}
areas = []

depth = 0
offset = 0
for i in input():
  if i == "/":
    depth -= 1
    if depth in high_water_marks:
      hwm = high_water_marks[depth]
      new_area = [hwm, offset - hwm]
      while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
      areas.append(new_area)
  elif i == "_":
    pass
  else:
    high_water_marks[depth] = offset
    depth += 1

  offset += 1

total = 0
for a in areas: total += a[1]
print(total)
sizes = [a[1] for a in areas]
sizes.insert(0, len(areas))
print(" ".join(map(str, sizes))) high_water_marks = {} high_water_marks {} areas = [] areas [] depth = 0 depth 0 offset = 0 offset 0 for i in input():
  if i == "/":
    depth -= 1
    if depth in high_water_marks:
      hwm = high_water_marks[depth]
      new_area = [hwm, offset - hwm]
      while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
      areas.append(new_area)
  elif i == "_":
    pass
  else:
    high_water_marks[depth] = offset
    depth += 1

  offset += 1 i input() input if i == "/":
    depth -= 1
    if depth in high_water_marks:
      hwm = high_water_marks[depth]
      new_area = [hwm, offset - hwm]
      while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
      areas.append(new_area)
  elif i == "_":
    pass
  else:
    high_water_marks[depth] = offset
    depth += 1

   i == "/" i "/" depth -= 1 depth 1 if depth in high_water_marks:
      hwm = high_water_marks[depth]
      new_area = [hwm, offset - hwm]
      while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
      areas.append(new_area)
   depth in high_water_marks depth high_water_marks hwm = high_water_marks[depth] hwm high_water_marks[depth] high_water_marks depth new_area = [hwm, offset - hwm] new_area [hwm, offset - hwm] hwm offset - hwm offset hwm while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
       len(areas) > 0 and areas[-1][0] > hwm len(areas) > 0 len(areas) len areas 0 areas[-1][0] > hwm areas[-1][0] [-1] areas -1 0 hwm a = areas.pop() a areas.pop() areas.pop areas pop new_area[1] += a[1] new_area[1] new_area 1 a[1] a 1 areas.append(new_area) areas.append areas append new_area elif i == "_":
    pass
   i == "_" i "_" high_water_marks[depth] = offset high_water_marks[depth] high_water_marks depth offset depth += 1 depth 1 offset += 1 offset 1 total = 0 total 0 for a in areas: total += a[1] a areas print(total) print total a[1] for a in areas for a in areas a areas for a in areas a[1] a 1 sizes = [a[1] for a in areas] sizes [a[1] for a in areas] sizes.insert(0, len(areas)) sizes.insert sizes insert 0 len(areas) len areas print(" ".join(map(str, sizes))) print " ".join(map(str, sizes)) " ".join " " join map(str, sizes) map str sizes depth = 0 0 depth high_water_marks = {} {} high_water_marks depth -= 1 1 depth a = areas.pop() areas.pop() a total = 0 0 total offset = 0 0 offset new_area = [hwm, offset - hwm] [hwm, offset - hwm] new_area areas = [] [] areas depth += 1 1 depth sizes = [a[1] for a in areas] [a[1] for a in areas] sizes hwm = high_water_marks[depth] high_water_marks[depth] hwm offset += 1 1 offset
high_water_marks = {}
areas = []

depth = 0
offset = 0
for i in input():
  if i == "/":
    depth -= 1
    if depth in high_water_marks:
      hwm = high_water_marks[depth]
      new_area = [hwm, offset - hwm]
      while len(areas) > 0 and areas[-1][0] > hwm:
        a = areas.pop()
        new_area[1] += a[1]
      areas.append(new_area)
  elif i == "_":
    pass
  else:
    high_water_marks[depth] = offset
    depth += 1

  offset += 1

total = 0
for a in areas: total += a[1]
print(total)
sizes = [a[1] for a in areas]
sizes.insert(0, len(areas))
print(" ".join(map(str, sizes)))