from collections import deque

S = input()

pool_q=deque()
slope_q=deque()

for i,s in enumerate(S):
    if s=="\\":
        slope_q.append(i)
        pool_q.append((i,0))
    elif s=="/":
        if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1]
SUM = 0
ans=[0]
cnt=0
for i in range(len(pool_q)):
    pool=pool_q.popleft()[1]
    if pool > 0:
        ans.append(pool)
        SUM+=pool
        cnt+=1
ans[0]=cnt
print(SUM)
print(*ans) from collections import deque S = input() S input() input pool_q=deque() pool_q deque() deque slope_q=deque() slope_q deque() deque for i,s in enumerate(S):
    if s=="\\":
        slope_q.append(i)
        pool_q.append((i,0))
    elif s=="/":
        if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] i s enumerate(S) enumerate S if s=="\\":
        slope_q.append(i)
        pool_q.append((i,0))
    elif s=="/":
        if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] s=="\\" s "\\" slope_q.append(i) slope_q.append slope_q append i pool_q.append((i,0)) pool_q.append pool_q append (i,0) i 0 elif s=="/":
        if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] s=="/" s "/" if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] len(slope_q) > 0 len(slope_q) len slope_q 0 pre_down=slope_q.pop() pre_down slope_q.pop() slope_q.pop slope_q pop plus=i-pre_down plus i-pre_down i pre_down while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] 1 pre_pool=pool_q.pop() pre_pool pool_q.pop() pool_q.pop pool_q pop if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1] pre_pool[0] == pre_down pre_pool[0] pre_pool 0 pre_down pool_q.append((pre_down,plus)) pool_q.append pool_q append (pre_down,plus) pre_down plus break plus+=pre_pool[1] plus pre_pool[1] pre_pool 1 SUM = 0 SUM 0 ans=[0] ans [0] 0 cnt=0 cnt 0 for i in range(len(pool_q)):
    pool=pool_q.popleft()[1]
    if pool > 0:
        ans.append(pool)
        SUM+=pool
        cnt+=1 i range(len(pool_q)) range len(pool_q) len pool_q pool=pool_q.popleft()[1] pool pool_q.popleft()[1] pool_q.popleft() pool_q.popleft pool_q popleft 1 if pool > 0:
        ans.append(pool)
        SUM+=pool
        cnt+=1 pool > 0 pool 0 ans.append(pool) ans.append ans append pool SUM+=pool SUM pool cnt+=1 cnt 1 ans[0]=cnt ans[0] ans 0 cnt print(SUM) print SUM print(*ans) print *ans ans cnt+=1 1 cnt plus+=pre_pool[1] pre_pool[1] plus pre_pool=pool_q.pop() pool_q.pop() pre_pool pool_q=deque() deque() pool_q slope_q=deque() deque() slope_q S = input() input() S cnt=0 0 cnt pool=pool_q.popleft()[1] pool_q.popleft()[1] pool SUM = 0 0 SUM ans=[0] [0] ans SUM+=pool pool SUM pre_down=slope_q.pop() slope_q.pop() pre_down plus=i-pre_down i-pre_down plus
from collections import deque

S = input()

pool_q=deque()
slope_q=deque()

for i,s in enumerate(S):
    if s=="\\":
        slope_q.append(i)
        pool_q.append((i,0))
    elif s=="/":
        if len(slope_q) > 0:
            pre_down=slope_q.pop()
            plus=i-pre_down
            while 1:
                pre_pool=pool_q.pop()
                if pre_pool[0] == pre_down:
                    pool_q.append((pre_down,plus))
                    break
                else:
                    plus+=pre_pool[1]
SUM = 0
ans=[0]
cnt=0
for i in range(len(pool_q)):
    pool=pool_q.popleft()[1]
    if pool > 0:
        ans.append(pool)
        SUM+=pool
        cnt+=1
ans[0]=cnt
print(SUM)
print(*ans)
