tochi=input()
s=[]
I=[]

sum=0
n=len(tochi)
for i in range(n):
    if tochi[i] == "\\":
        s.append(i)
    elif tochi[i] == "/" and s:
        j = s.pop()
        a = i - j
        sum += a
	
        while I and I[-1][0] > j:
            a += I.pop()[1]
        I.append([j, a])

print(sum)
print(len(I), *(a for j, a in I))
    
 tochi=input() tochi input() input s=[] s [] I=[] I [] sum=0 sum 0 n=len(tochi) n len(tochi) len tochi for i in range(n):
    if tochi[i] == "\\":
        s.append(i)
    elif tochi[i] == "/" and s:
        j = s.pop()
        a = i - j
        sum += a
	
        while I and I[-1][0] > j:
            a += I.pop()[1]
        I.append([j, a]) i range(n) range n if tochi[i] == "\\":
        s.append(i)
    elif tochi[i] == "/" and s:
        j = s.pop()
        a = i - j
        sum += a
	
        while I and I[-1][0] > j:
            a += I.pop()[1]
        I.append([j, a]) tochi[i] == "\\" tochi[i] tochi i "\\" s.append(i) s.append s append i elif tochi[i] == "/" and s:
        j = s.pop()
        a = i - j
        sum += a
	
        while I and I[-1][0] > j:
            a += I.pop()[1]
        I.append([j, a]) tochi[i] == "/" and s tochi[i] == "/" tochi[i] tochi i "/" s j = s.pop() j s.pop() s.pop s pop a = i - j a i - j i j sum += a sum a while I and I[-1][0] > j:
            a += I.pop()[1]
         I and I[-1][0] > j I I[-1][0] > j I[-1][0] [-1] I -1 0 j a += I.pop()[1] a I.pop()[1] I.pop() I.pop I pop 1 I.append([j, a]) I.append I append [j, a] j a print(sum) print sum a for j, a in I for j, a in I j a I for j, a in I a print(len(I), *(a for j, a in I)) print len(I) len I *(a for j, a in I) (a for j, a in I) tochi=input() input() tochi n=len(tochi) len(tochi) n I=[] [] I j = s.pop() s.pop() j s=[] [] s sum=0 0 sum sum += a a sum a = i - j i - j a a += I.pop()[1] I.pop()[1] a
tochi=input()
s=[]
I=[]

sum=0
n=len(tochi)
for i in range(n):
    if tochi[i] == "\\":
        s.append(i)
    elif tochi[i] == "/" and s:
        j = s.pop()
        a = i - j
        sum += a
	
        while I and I[-1][0] > j:
            a += I.pop()[1]
        I.append([j, a])

print(sum)
print(len(I), *(a for j, a in I))
    

