n=input()
a=[]
area=[]
x1=[]
x2=[]

x=1
for i in n:
	if i=='\\':
		a.append(x)
		
	elif i=='/' and len(a)>=1:
		area.append(x-a[len(a)-1])
		x1.append(a[len(a)-1])
		x2.append(x)
		a.pop()		
		
		for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	x+=1

print(sum(area))
print(len(area),*area)

	
 n=input() n input() input a=[] a [] area=[] area [] x1=[] x1 [] x2=[] x2 [] x=1 x 1 for i in n:
	if i=='\\':
		a.append(x)
		
	elif i=='/' and len(a)>=1:
		area.append(x-a[len(a)-1])
		x1.append(a[len(a)-1])
		x2.append(x)
		a.pop()		
		
		for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	x+=1 i n if i=='\\':
		a.append(x)
		
	elif i=='/' and len(a)>=1:
		area.append(x-a[len(a)-1])
		x1.append(a[len(a)-1])
		x2.append(x)
		a.pop()		
		
		for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	 i=='\\' i '\\' a.append(x) a.append a append x elif i=='/' and len(a)>=1:
		area.append(x-a[len(a)-1])
		x1.append(a[len(a)-1])
		x2.append(x)
		a.pop()		
		
		for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	 i=='/' and len(a)>=1 i=='/' i '/' len(a)>=1 len(a) len a 1 area.append(x-a[len(a)-1]) area.append area append x-a[len(a)-1] x a[len(a)-1] a len(a)-1 len(a) len a 1 x1.append(a[len(a)-1]) x1.append x1 append a[len(a)-1] a len(a)-1 len(a) len a 1 x2.append(x) x2.append x2 append x a.pop() a.pop a pop for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	 i range(len(x1)-2,-1,-1) range len(x1)-2 len(x1) len x1 2 -1 -1 if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	 x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i] x1[len(x1)-1]<x1[i] x1[len(x1)-1] x1 len(x1)-1 len(x1) len x1 1 x1[i] x1 i x2[len(x2)-1]>x2[i] x2[len(x2)-1] x2 len(x2)-1 len(x2) len x2 1 x2[i] x2 i x1.pop(i) x1.pop x1 pop i x2.pop(i) x2.pop x2 pop i area[i]=area[i]+area[len(area)-1] area[i] area i area[i]+area[len(area)-1] area[i] area i area[len(area)-1] area len(area)-1 len(area) len area 1 area.pop() area.pop area pop x+=1 x 1 print(sum(area)) print sum(area) sum area print(len(area),*area) print len(area) len area *area area x2=[] [] x2 a=[] [] a area=[] [] area x1=[] [] x1 n=input() input() n x+=1 1 x x=1 1 x
n=input()
a=[]
area=[]
x1=[]
x2=[]

x=1
for i in n:
	if i=='\\':
		a.append(x)
		
	elif i=='/' and len(a)>=1:
		area.append(x-a[len(a)-1])
		x1.append(a[len(a)-1])
		x2.append(x)
		a.pop()		
		
		for i in range(len(x1)-2,-1,-1):	
			if x1[len(x1)-1]<x1[i] and x2[len(x2)-1]>x2[i]:
				x1.pop(i)
				x2.pop(i)
				area[i]=area[i]+area[len(area)-1]
				area.pop()
	x+=1

print(sum(area))
print(len(area),*area)

	

