from collections import deque

class peke:
    def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
    

S1=deque()
S2=deque()
total=0
A=input()

for n in range(len(A)):
    if A[n]=='\\':
        S1.append(n)
    elif A[n]=='/' and S1:
        j=S1.pop()
        now=n-j
        total=total+now
        while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
        S2.append(peke(j,n,now))

print(total)
print(len(S2),end ="")
while S2:
    print(" ",end="")
    print(S2[0].S,end="")
    S2.popleft()
print()
 from collections import deque class peke:
    def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
     peke def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
     __init__ self.start=Start self.start self start Start self.end=End self.end self end End self.S=S self.S self S S self self Start Start End End S S S1=deque() S1 deque() deque S2=deque() S2 deque() deque total=0 total 0 A=input() A input() input for n in range(len(A)):
    if A[n]=='\\':
        S1.append(n)
    elif A[n]=='/' and S1:
        j=S1.pop()
        now=n-j
        total=total+now
        while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
        S2.append(peke(j,n,now)) n range(len(A)) range len(A) len A if A[n]=='\\':
        S1.append(n)
    elif A[n]=='/' and S1:
        j=S1.pop()
        now=n-j
        total=total+now
        while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
        S2.append(peke(j,n,now)) A[n]=='\\' A[n] A n '\\' S1.append(n) S1.append S1 append n elif A[n]=='/' and S1:
        j=S1.pop()
        now=n-j
        total=total+now
        while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
        S2.append(peke(j,n,now)) A[n]=='/' and S1 A[n]=='/' A[n] A n '/' S1 j=S1.pop() j S1.pop() S1.pop S1 pop now=n-j now n-j n j total=total+now total total+now total now while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
         S2 if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
         S2[-1].start>j and S2[-1].end<n S2[-1].start>j S2[-1].start [-1] S2 -1 start j S2[-1].end<n S2[-1].end [-1] S2 -1 end n now=now+S2[-1].S now now+S2[-1].S now S2[-1].S [-1] S2 -1 S S2.pop() S2.pop S2 pop break S2.append(peke(j,n,now)) S2.append S2 append peke(j,n,now) peke j n now print(total) print total print(len(S2),end ="") print len(S2) len S2 end ="" end "" while S2:
    print(" ",end="")
    print(S2[0].S,end="")
    S2.popleft() S2 print(" ",end="") print " " end="" end "" print(S2[0].S,end="") print S2[0].S [0] S2 0 S end="" end "" S2.popleft() S2.popleft S2 popleft print() print total=0 0 total S1=deque() deque() S1 j=S1.pop() S1.pop() j S2=deque() deque() S2 A=input() input() A class peke:
    def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
     class peke:
    def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
     peke total=total+now total+now total now=now+S2[-1].S now+S2[-1].S now now=n-j n-j now
from collections import deque

class peke:
    def __init__(self,Start,End,S):
        self.start=Start
        self.end=End
        self.S=S
    

S1=deque()
S2=deque()
total=0
A=input()

for n in range(len(A)):
    if A[n]=='\\':
        S1.append(n)
    elif A[n]=='/' and S1:
        j=S1.pop()
        now=n-j
        total=total+now
        while S2:
            if S2[-1].start>j and S2[-1].end<n:
                now=now+S2[-1].S
                S2.pop()
            else:
                break
        S2.append(peke(j,n,now))

print(total)
print(len(S2),end ="")
while S2:
    print(" ",end="")
    print(S2[0].S,end="")
    S2.popleft()
print()

