s = input()
st1=[]
st2=[]
st3=[]
total=0
for i in range(len(s)):
	c=s[i]
	if c=='\\':
		st1.append(i)
	elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			
print(total)
n = len(st3)
print(n,end='')
for i in range(n):
	print(' '+str(st3[i]),end='')
print()
 s = input() s input() input st1=[] st1 [] st2=[] st2 [] st3=[] st3 [] total=0 total 0 for i in range(len(s)):
	c=s[i]
	if c=='\\':
		st1.append(i)
	elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			 i range(len(s)) range len(s) len s c=s[i] c s[i] s i if c=='\\':
		st1.append(i)
	elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			 c=='\\' c '\\' st1.append(i) st1.append st1 append i elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			 c=='/' c '/' if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			 len(st1) > 0 len(st1) len st1 0 j = st1.pop() j st1.pop() st1.pop st1 pop a = i - j a i - j i j total+=a total a tmp=0 tmp 0 while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			 len(st2)>0 and st2[-1]>j len(st2)>0 len(st2) len st2 0 st2[-1]>j st2[-1] st2 -1 j st2.pop() st2.pop st2 pop tmp+=st3.pop() tmp st3.pop() st3.pop st3 pop st3.append(a+tmp) st3.append st3 append a+tmp a tmp st2.append(j) st2.append st2 append j print(total) print total n = len(st3) n len(st3) len st3 print(n,end='') print n end='' end '' for i in range(n):
	print(' '+str(st3[i]),end='') i range(n) range n print(' '+str(st3[i]),end='') print ' '+str(st3[i]) ' ' str(st3[i]) str st3[i] st3 i end='' end '' print() print c=s[i] s[i] c st1=[] [] st1 total=0 0 total n = len(st3) len(st3) n st2=[] [] st2 tmp=0 0 tmp a = i - j i - j a st3=[] [] st3 s = input() input() s tmp+=st3.pop() st3.pop() tmp j = st1.pop() st1.pop() j total+=a a total
s = input()
st1=[]
st2=[]
st3=[]
total=0
for i in range(len(s)):
	c=s[i]
	if c=='\\':
		st1.append(i)
	elif c=='/':
		if len(st1) > 0:
			j = st1.pop()
			a = i - j
			total+=a
			tmp=0
			while len(st2)>0 and st2[-1]>j:
				st2.pop()
				tmp+=st3.pop()
			st3.append(a+tmp)
			st2.append(j)
			
print(total)
n = len(st3)
print(n,end='')
for i in range(n):
	print(' '+str(st3[i]),end='')
print()

