import sys,bisect
sys.setrecursionlimit(15000)
s = sys.stdin.readline().rstrip()
st = []
ars = []
ar = 0
for i,c in enumerate(s):
  if c == "\\":
    st.append(i)
  elif c == "/":
    if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0
print(sum([ar for ar,_ in ars]))
if len(ars)==0:
  print(0)
else:
  print(len(ars)," ".join(map(str,[ar for ar,_ in ars]))) import sys,bisect sys bisect sys.setrecursionlimit(15000) sys.setrecursionlimit sys setrecursionlimit 15000 s = sys.stdin.readline().rstrip() s sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip st = [] st [] ars = [] ars [] ar = 0 ar 0 for i,c in enumerate(s):
  if c == "\\":
    st.append(i)
  elif c == "/":
    if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0 i c enumerate(s) enumerate s if c == "\\":
    st.append(i)
  elif c == "/":
    if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0 c == "\\" c "\\" st.append(i) st.append st append i elif c == "/":
    if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0 c == "/" c "/" if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0 st j = st.pop() j st.pop() st.pop st pop ar += i-j ar i-j i j while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
       ars and j < ars[-1][1] ars j < ars[-1][1] j ars[-1][1] [-1] ars -1 1 ar0,_ = ars.pop() ar0 ars.pop() ars.pop ars pop _ ar += ar0 ar ar0 ars.append([ar,j]) ars.append ars append [ar,j] ar j ar = 0 ar 0 ar for ar,_ in ars for ar,_ in ars ar _ ars for ar,_ in ars ar print(sum([ar for ar,_ in ars])) print sum([ar for ar,_ in ars]) sum [ar for ar,_ in ars] if len(ars)==0:
  print(0)
else:
  print(len(ars)," ".join(map(str,[ar for ar,_ in ars]))) len(ars)==0 len(ars) len ars 0 print(0) print 0 ar for ar,_ in ars for ar,_ in ars ar _ ars for ar,_ in ars ar print(len(ars)," ".join(map(str,[ar for ar,_ in ars]))) print len(ars) len ars " ".join(map(str,[ar for ar,_ in ars])) " ".join " " join map(str,[ar for ar,_ in ars]) map str [ar for ar,_ in ars] ars = [] [] ars j = st.pop() st.pop() j ar += i-j i-j ar ar += ar0 ar0 ar ar = 0 0 ar _ = ars.pop() ars.pop() _ s = sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() s ar = 0 0 ar st = [] [] st ar0,_ = ars.pop() ars.pop() ar0
import sys,bisect
sys.setrecursionlimit(15000)
s = sys.stdin.readline().rstrip()
st = []
ars = []
ar = 0
for i,c in enumerate(s):
  if c == "\\":
    st.append(i)
  elif c == "/":
    if st:
      j = st.pop()
      ar += i-j
      while ars and j < ars[-1][1]:
        ar0,_ = ars.pop()
        ar += ar0
      ars.append([ar,j])
      ar = 0
print(sum([ar for ar,_ in ars]))
if len(ars)==0:
  print(0)
else:
  print(len(ars)," ".join(map(str,[ar for ar,_ in ars])))
