
t=input()
s1=[]
s2=[]
pond=[]
totalsum=0

for i in range(len(t)):
    if t[i]=="\\" :
        s1.append(i)
    elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i)


print(totalsum)
print(len(pond),*pond)

 t=input() t input() input s1=[] s1 [] s2=[] s2 [] pond=[] pond [] totalsum=0 totalsum 0 for i in range(len(t)):
    if t[i]=="\\" :
        s1.append(i)
    elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i) i range(len(t)) range len(t) len t if t[i]=="\\" :
        s1.append(i)
    elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i) t[i]=="\\" t[i] t i "\\" s1.append(i) s1.append s1 append i elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i) t[i]=="/" and len(s1)!=0 t[i]=="/" t[i] t i "/" len(s1)!=0 len(s1) len s1 0 p1=s1.pop() p1 s1.pop() s1.pop s1 pop sum=i-p1 sum i-p1 i p1 totalsum+=sum totalsum sum while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
         len(s2)>0 len(s2) len s2 0 if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
         s2[-1]>p1 s2[-1] s2 -1 p1 s2.pop() s2.pop s2 pop sum+=pond.pop() sum pond.pop() pond.pop pond pop break pond.append(sum) pond.append pond append sum s2.append(i) s2.append s2 append i print(totalsum) print totalsum print(len(pond),*pond) print len(pond) len pond *pond pond p1=s1.pop() s1.pop() p1 s2=[] [] s2 sum=i-p1 i-p1 sum sum+=pond.pop() pond.pop() sum s1=[] [] s1 totalsum=0 0 totalsum totalsum+=sum sum totalsum t=input() input() t pond=[] [] pond

t=input()
s1=[]
s2=[]
pond=[]
totalsum=0

for i in range(len(t)):
    if t[i]=="\\" :
        s1.append(i)
    elif t[i]=="/" and len(s1)!=0:
        p1=s1.pop()
        sum=i-p1
        totalsum+=sum
        while len(s2)>0:
            if s2[-1]>p1:
                s2.pop()
                sum+=pond.pop()
            else:
                break
        pond.append(sum)
        s2.append(i)


print(totalsum)
print(len(pond),*pond)


