strs = input()
h = 0
heights = [0]
max_h = 0
k = []
sum = 0
for i, s in enumerate(strs, 1):
    if s=='\\':
        h -= 1
        heights.append(h)
    elif s=='/':
        h += 1
        heights.append(h)
        if h>max_h:
          max_h = h
          continue
        t = -2
        while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
    else:
        heights.append(h)
        continue
print(sum)
ans = [str(k[-1]) for k in k]
print(len(ans), *ans) strs = input() strs input() input h = 0 h 0 heights = [0] heights [0] 0 max_h = 0 max_h 0 k = [] k [] sum = 0 sum 0 for i, s in enumerate(strs, 1):
    if s=='\\':
        h -= 1
        heights.append(h)
    elif s=='/':
        h += 1
        heights.append(h)
        if h>max_h:
          max_h = h
          continue
        t = -2
        while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
    else:
        heights.append(h)
        continue i s enumerate(strs, 1) enumerate strs 1 if s=='\\':
        h -= 1
        heights.append(h)
    elif s=='/':
        h += 1
        heights.append(h)
        if h>max_h:
          max_h = h
          continue
        t = -2
        while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
    else:
        heights.append(h)
        continue s=='\\' s '\\' h -= 1 h 1 heights.append(h) heights.append heights append h elif s=='/':
        h += 1
        heights.append(h)
        if h>max_h:
          max_h = h
          continue
        t = -2
        while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
     s=='/' s '/' h += 1 h 1 heights.append(h) heights.append heights append h if h>max_h:
          max_h = h
          continue
         h>max_h h max_h max_h = h max_h h continue t = -2 t -2 while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
     t+i+1>=0 t+i+1 t+i t i 1 0 if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
     heights[t]==h heights[t] heights t h sum += (-t-3)+1 sum (-t-3)+1 -t-3 -t t 3 1 tmp = (-t-3)+1 tmp (-t-3)+1 -t-3 -t t 3 1 if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                 len(k)>0 len(k) len k 0 c = len(k) c len(k) len k for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                 ts te tm k[::-1] k ::-1 -1 c -= 1 c 1 if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                 t+i+1<ts and te<i t+i+1<ts t+i+1 t+i t i 1 ts te<i te i k.pop(c) k.pop k pop c tmp += tm tmp tm k.append([t+i+1, i, tmp]) k.append k append [t+i+1, i, tmp] t+i+1 t+i t i 1 i tmp break t -= 1 t 1 continue heights.append(h) heights.append heights append h continue print(sum) print sum str(k[-1]) for k in k for k in k k k for k in k str(k[-1]) str k[-1] k -1 ans = [str(k[-1]) for k in k] ans [str(k[-1]) for k in k] print(len(ans), *ans) print len(ans) len ans *ans ans t -= 1 1 t max_h = h h max_h heights = [0] [0] heights sum = 0 0 sum sum += (-t-3)+1 (-t-3)+1 sum max_h = 0 0 max_h k = [] [] k tmp += tm tm tmp h -= 1 1 h tmp = (-t-3)+1 (-t-3)+1 tmp c -= 1 1 c ans = [str(k[-1]) for k in k] [str(k[-1]) for k in k] ans strs = input() input() strs h += 1 1 h c = len(k) len(k) c t = -2 -2 t h = 0 0 h
strs = input()
h = 0
heights = [0]
max_h = 0
k = []
sum = 0
for i, s in enumerate(strs, 1):
    if s=='\\':
        h -= 1
        heights.append(h)
    elif s=='/':
        h += 1
        heights.append(h)
        if h>max_h:
          max_h = h
          continue
        t = -2
        while t+i+1>=0:
            if heights[t]==h:
                sum += (-t-3)+1
                tmp = (-t-3)+1
                if len(k)>0:
                  c = len(k)
                  for ts, te, tm in k[::-1]:
                    c -= 1
                    if t+i+1<ts and te<i:
                        k.pop(c)
                        tmp += tm
                k.append([t+i+1, i, tmp])
                break
            else:
                t -= 1
                continue
    else:
        heights.append(h)
        continue
print(sum)
ans = [str(k[-1]) for k in k]
print(len(ans), *ans)
