# coding: utf-8
# Here your code
stack1=[] # \????????????????????????????¨???¶
stack2=[] #???stack1???????????????????????¨??¢???????¨???¶
sum=0
for i,c in enumerate(input()):
    if c =="\\":
        stack1.append(i)
    elif c=="/":
        if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
    
print(sum)
print(len(stack2),*(a for j,a in stack2)) stack1=[] stack1 [] stack2=[] stack2 [] sum=0 sum 0 for i,c in enumerate(input()):
    if c =="\\":
        stack1.append(i)
    elif c=="/":
        if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
     i c enumerate(input()) enumerate input() input if c =="\\":
        stack1.append(i)
    elif c=="/":
        if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
     c =="\\" c "\\" stack1.append(i) stack1.append stack1 append i elif c=="/":
        if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
     c=="/" c "/" if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
     stack1 poped = stack1.pop() poped stack1.pop() stack1.pop stack1 pop res = i-poped res i-poped i poped sum += res sum res while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
             stack2 and stack2[-1][0]>poped stack2 stack2[-1][0]>poped stack2[-1][0] [-1] stack2 -1 0 poped res+=stack2.pop()[1] res stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append([poped,res]) stack2.append stack2 append [poped,res] poped res print(sum) print sum a for j,a in stack2 for j,a in stack2 j a stack2 for j,a in stack2 a print(len(stack2),*(a for j,a in stack2)) print len(stack2) len stack2 *(a for j,a in stack2) (a for j,a in stack2) res = i-poped i-poped res poped = stack1.pop() stack1.pop() poped sum += res res sum res+=stack2.pop()[1] stack2.pop()[1] res sum=0 0 sum stack2=[] [] stack2 stack1=[] [] stack1
# coding: utf-8
# Here your code
stack1=[] # \????????????????????????????¨???¶
stack2=[] #???stack1???????????????????????¨??¢???????¨???¶
sum=0
for i,c in enumerate(input()):
    if c =="\\":
        stack1.append(i)
    elif c=="/":
        if stack1:
            poped = stack1.pop()
            res = i-poped
            sum += res
            while stack2 and stack2[-1][0]>poped:
                res+=stack2.pop()[1]
            stack2.append([poped,res])
    
print(sum)
print(len(stack2),*(a for j,a in stack2))