#\??¨?????????????´???????????????????
RL=[]
#?°´??????????????????????????¨??¢??????????´???????????????????
SL=[]

#\?????????RL????????????????????????????????????
def downer(index):
    RL.append(index)

#/?????????RL??????\????????????????????¢???????¨???????SL???????´?
def upper(index):
    if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return

L = input()
index = 0
for i in L:
    if i =="\\":
        downer(index)
        index += 1
    elif i =="/":
        upper(index)
        index += 1
    else:
        index += 1
AL =[]
for i in SL:
    AL.append(i[1])
print(str(sum(AL)))
if len(AL) == 0:
    print(len(AL))
else:
    print(len(AL),end=" ")
    print(" ".join(map(str,AL))) RL=[] RL [] SL=[] SL [] def downer(index):
    RL.append(index)

#/?????????RL??????\????????????????????¢???????¨???????SL???????´? downer RL.append(index) RL.append RL append index index index def upper(index):
    if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return upper if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return len(RL) > 0 len(RL) len RL 0 p = RL.pop() p RL.pop() RL.pop RL pop q = index q index s = q - p s q - p q p if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
     len(SL) > 0 len(SL) len SL 0 QL = SL[::-1] QL SL[::-1] SL ::-1 -1 for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
             i QL if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
             i[0] > p i[0] i 0 p s += SL.pop()[1] s SL.pop()[1] SL.pop() SL.pop SL pop 1 break SL.append([p, s]) SL.append SL append [p, s] p s index index L = input() L input() input index = 0 index 0 for i in L:
    if i =="\\":
        downer(index)
        index += 1
    elif i =="/":
        upper(index)
        index += 1
    else:
        index += 1 i L if i =="\\":
        downer(index)
        index += 1
    elif i =="/":
        upper(index)
        index += 1
    else:
        index += 1 i =="\\" i "\\" downer(index) downer index index += 1 index 1 elif i =="/":
        upper(index)
        index += 1
     i =="/" i "/" upper(index) upper index index += 1 index 1 index += 1 index 1 AL =[] AL [] for i in SL:
    AL.append(i[1]) i SL AL.append(i[1]) AL.append AL append i[1] i 1 print(str(sum(AL))) print str(sum(AL)) str sum(AL) sum AL if len(AL) == 0:
    print(len(AL))
else:
    print(len(AL),end=" ")
    print(" ".join(map(str,AL))) len(AL) == 0 len(AL) len AL 0 print(len(AL)) print len(AL) len AL print(len(AL),end=" ") print len(AL) len AL end=" " end " " print(" ".join(map(str,AL))) print " ".join(map(str,AL)) " ".join " " join map(str,AL) map str AL index += 1 1 index RL=[] [] RL index += 1 1 index index += 1 1 index AL =[] [] AL SL=[] [] SL index = 0 0 index L = input() input() L def upper(index):
    if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return def upper(index):
    if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return upper def downer(index):
    RL.append(index)

#/?????????RL??????\????????????????????¢???????¨???????SL???????´? def downer(index):
    RL.append(index)

#/?????????RL??????\????????????????????¢???????¨???????SL???????´? downer
#\??¨?????????????´???????????????????
RL=[]
#?°´??????????????????????????¨??¢??????????´???????????????????
SL=[]

#\?????????RL????????????????????????????????????
def downer(index):
    RL.append(index)

#/?????????RL??????\????????????????????¢???????¨???????SL???????´?
def upper(index):
    if len(RL) > 0:
        p = RL.pop()
        q = index
        s = q - p
        if len(SL) > 0:
            QL = SL[::-1]
            for i in QL:
                if i[0] > p:
                    s += SL.pop()[1]
                else:
                    break
            SL.append([p, s])
        else: SL.append([p, s])
    else:return

L = input()
index = 0
for i in L:
    if i =="\\":
        downer(index)
        index += 1
    elif i =="/":
        upper(index)
        index += 1
    else:
        index += 1
AL =[]
for i in SL:
    AL.append(i[1])
print(str(sum(AL)))
if len(AL) == 0:
    print(len(AL))
else:
    print(len(AL),end=" ")
    print(" ".join(map(str,AL)))