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

