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

