def _main():
  text = list(input())

  S1 = []
  S2 = []
  area = 0

  for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
  print(area)
  print(len(S2), *[n[1] for n in S2])




if __name__ == '__main__':
  _main() def _main():
  text = list(input())

  S1 = []
  S2 = []
  area = 0

  for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
  print(area)
  print(len(S2), *[n[1] for n in S2]) _main text = list(input()) text list(input()) list input() input S1 = [] S1 [] S2 = [] S2 [] area = 0 area 0 for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
   i range(len(text)) range len(text) len text if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
   text[i] == '\\' text[i] text i '\\' S1.append(i) S1.append S1 append i elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
   text[i] == '/' and len(S1) > 0 text[i] == '/' text[i] text i '/' len(S1) > 0 len(S1) len S1 0 j = S1.pop() j S1.pop() S1.pop S1 pop section_area = i - j section_area i - j i j area += section_area area section_area while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
       len(S2) > 0 and S2[-1][0] > j len(S2) > 0 len(S2) len S2 0 S2[-1][0] > j S2[-1][0] [-1] S2 -1 0 j section_area += S2[-1][1] section_area S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop S2.append([j, section_area]) S2.append S2 append [j, section_area] j section_area print(area) print area n[1] for n in S2 for n in S2 n S2 for n in S2 n[1] n 1 print(len(S2), *[n[1] for n in S2]) print len(S2) len S2 *[n[1] for n in S2] [n[1] for n in S2] if __name__ == '__main__':
  _main() __name__ == '__main__' __name__ '__main__' _main() _main def _main():
  text = list(input())

  S1 = []
  S2 = []
  area = 0

  for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
  print(area)
  print(len(S2), *[n[1] for n in S2]) def _main():
  text = list(input())

  S1 = []
  S2 = []
  area = 0

  for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
  print(area)
  print(len(S2), *[n[1] for n in S2]) _main
def _main():
  text = list(input())

  S1 = []
  S2 = []
  area = 0

  for i in range(len(text)):
    if text[i] == '\\':
      S1.append(i)
    elif text[i] == '/' and len(S1) > 0:
      j = S1.pop()
      section_area = i - j
      area += section_area
      while len(S2) > 0 and S2[-1][0] > j:
        section_area += S2[-1][1]
        S2.pop()
      S2.append([j, section_area])
  print(area)
  print(len(S2), *[n[1] for n in S2])




if __name__ == '__main__':
  _main()
