s=input()


#\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\
    

stack=[]
i=0
result=0
#みずたまりは、[左側の位置と、数量を表す]
mizutamari=[[-1,0]]
for item in s:
    #print(stack,mizutamari)
    if item=="\\":
        stack.append(i)
    elif item=="/":
        if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


    i+=1
print(result)
s=""
for item in mizutamari[1:]:
    s+=str(item[1])+" "

if result==0:
    print(0)
else:
    print(len(mizutamari)-1,s[:-1]) s=input() s input() input stack=[] stack [] i=0 i 0 result=0 result 0 mizutamari=[[-1,0]] mizutamari [[-1,0]] [-1,0] -1 0 for item in s:
    #print(stack,mizutamari)
    if item=="\\":
        stack.append(i)
    elif item=="/":
        if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


    i+=1 item s if item=="\\":
        stack.append(i)
    elif item=="/":
        if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


     item=="\\" item "\\" stack.append(i) stack.append stack append i elif item=="/":
        if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


     item=="/" item "/" if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


     len(stack)>0 len(stack) len stack 0 temp=stack.pop() temp stack.pop() stack.pop stack pop result+=i-temp result i-temp i temp left=mizutamari.pop() left mizutamari.pop() mizutamari.pop mizutamari pop if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


     left[0]>temp left[0] left 0 temp vol=i-temp vol i-temp i temp while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
             1 vol=left[1]+vol vol left[1]+vol left[1] left 1 vol mizutamari.append([temp,vol]) mizutamari.append mizutamari append [temp,vol] temp vol if len(mizutamari)<=2:
                        break
                     len(mizutamari)<=2 len(mizutamari) len mizutamari 2 break bk=mizutamari.pop() bk mizutamari.pop() mizutamari.pop mizutamari pop bkbk=mizutamari.pop() bkbk mizutamari.pop() mizutamari.pop mizutamari pop if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
             bkbk<bk bkbk bk mizutamari.append(bkbk) mizutamari.append mizutamari append bkbk mizutamari.append(bk) mizutamari.append mizutamari append bk break left=bkbk left bkbk mizutamari.append(left) mizutamari.append mizutamari append left mizutamari.append([temp,i-temp]) mizutamari.append mizutamari append [temp,i-temp] temp i-temp i temp i+=1 i 1 print(result) print result s="" s "" for item in mizutamari[1:]:
    s+=str(item[1])+" " item mizutamari[1:] mizutamari 1: 1 s+=str(item[1])+" " s str(item[1])+" " str(item[1]) str item[1] item 1 " " if result==0:
    print(0)
else:
    print(len(mizutamari)-1,s[:-1]) result==0 result 0 print(0) print 0 print(len(mizutamari)-1,s[:-1]) print len(mizutamari)-1 len(mizutamari) len mizutamari 1 s[:-1] s :-1 -1 left=bkbk bkbk left result=0 0 result stack=[] [] stack result+=i-temp i-temp result mizutamari=[[-1,0]] [[-1,0]] mizutamari left=mizutamari.pop() mizutamari.pop() left vol=i-temp i-temp vol s+=str(item[1])+" " str(item[1])+" " s i+=1 1 i bkbk=mizutamari.pop() mizutamari.pop() bkbk vol=left[1]+vol left[1]+vol vol bk=mizutamari.pop() mizutamari.pop() bk temp=stack.pop() stack.pop() temp i=0 0 i s=input() input() s s="" "" s
s=input()


#\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\
    

stack=[]
i=0
result=0
#みずたまりは、[左側の位置と、数量を表す]
mizutamari=[[-1,0]]
for item in s:
    #print(stack,mizutamari)
    if item=="\\":
        stack.append(i)
    elif item=="/":
        if len(stack)>0:
            temp=stack.pop()
            result+=i-temp
            left=mizutamari.pop()
            if left[0]>temp:
                vol=i-temp
                while 1:
                    vol=left[1]+vol
                    mizutamari.append([temp,vol])
                    if len(mizutamari)<=2:
                        break
                    bk=mizutamari.pop()
                    bkbk=mizutamari.pop()
                    if bkbk<bk:
                        mizutamari.append(bkbk)
                        mizutamari.append(bk)
                        break
                    else:
                        left=bkbk




                
            else:
                #print(left[0],"<",temp,":","naze",left,temp)
                mizutamari.append(left)
                mizutamari.append([temp,i-temp])
                #print(mizutamari)


    i+=1
print(result)
s=""
for item in mizutamari[1:]:
    s+=str(item[1])+" "

if result==0:
    print(0)
else:
    print(len(mizutamari)-1,s[:-1])
