#alds13c
from collections import deque

d_stack=deque()
res_stack=deque()
s = input()

for i in range(len(s)):
    #print(d_stack,res_stack)
    if s[i]=="\\":
        d_stack.append(i)
    elif s[i]=="/":
        if len(d_stack)==0:
            continue
        left = d_stack.pop()
        area = i-left
        #res_stack.append((left,area))
        if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area))

ans=0
v_devided=[]
for pair in res_stack:
    ans += pair[1]
    v_devided.append(str(pair[1]))
print(ans)
if len(v_devided)>0:
    print(len(v_devided)," ".join(v_devided))
else:
    print(0) from collections import deque d_stack=deque() d_stack deque() deque res_stack=deque() res_stack deque() deque s = input() s input() input for i in range(len(s)):
    #print(d_stack,res_stack)
    if s[i]=="\\":
        d_stack.append(i)
    elif s[i]=="/":
        if len(d_stack)==0:
            continue
        left = d_stack.pop()
        area = i-left
        #res_stack.append((left,area))
        if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area)) i range(len(s)) range len(s) len s if s[i]=="\\":
        d_stack.append(i)
    elif s[i]=="/":
        if len(d_stack)==0:
            continue
        left = d_stack.pop()
        area = i-left
        #res_stack.append((left,area))
        if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area)) s[i]=="\\" s[i] s i "\\" d_stack.append(i) d_stack.append d_stack append i elif s[i]=="/":
        if len(d_stack)==0:
            continue
        left = d_stack.pop()
        area = i-left
        #res_stack.append((left,area))
        if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area)) s[i]=="/" s[i] s i "/" if len(d_stack)==0:
            continue
         len(d_stack)==0 len(d_stack) len d_stack 0 continue left = d_stack.pop() left d_stack.pop() d_stack.pop d_stack pop area = i-left area i-left i left if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area)) len(res_stack)>0 len(res_stack) len res_stack 0 flag=True flag True mergeareasum=0 mergeareasum 0 while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
         flag if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
         len(res_stack)>0 and left<res_stack[-1][0] len(res_stack)>0 len(res_stack) len res_stack 0 left<res_stack[-1][0] left res_stack[-1][0] [-1] res_stack -1 0 mc = res_stack.pop() mc res_stack.pop() res_stack.pop res_stack pop mergeareasum += mc[1] mergeareasum mc[1] mc 1 flag = False flag False res_stack.append((left,area+mergeareasum)) res_stack.append res_stack append (left,area+mergeareasum) left area+mergeareasum area mergeareasum res_stack.append((left,area)) res_stack.append res_stack append (left,area) left area ans=0 ans 0 v_devided=[] v_devided [] for pair in res_stack:
    ans += pair[1]
    v_devided.append(str(pair[1])) pair res_stack ans += pair[1] ans pair[1] pair 1 v_devided.append(str(pair[1])) v_devided.append v_devided append str(pair[1]) str pair[1] pair 1 print(ans) print ans if len(v_devided)>0:
    print(len(v_devided)," ".join(v_devided))
else:
    print(0) len(v_devided)>0 len(v_devided) len v_devided 0 print(len(v_devided)," ".join(v_devided)) print len(v_devided) len v_devided " ".join(v_devided) " ".join " " join v_devided print(0) print 0 res_stack=deque() deque() res_stack flag=True True flag mc = res_stack.pop() res_stack.pop() mc d_stack=deque() deque() d_stack v_devided=[] [] v_devided flag = False False flag ans=0 0 ans s = input() input() s area = i-left i-left area ans += pair[1] pair[1] ans mergeareasum=0 0 mergeareasum mergeareasum += mc[1] mc[1] mergeareasum left = d_stack.pop() d_stack.pop() left
#alds13c
from collections import deque

d_stack=deque()
res_stack=deque()
s = input()

for i in range(len(s)):
    #print(d_stack,res_stack)
    if s[i]=="\\":
        d_stack.append(i)
    elif s[i]=="/":
        if len(d_stack)==0:
            continue
        left = d_stack.pop()
        area = i-left
        #res_stack.append((left,area))
        if len(res_stack)>0:
            flag=True
            #merge_candidate = []
            mergeareasum=0
            while flag:
                if len(res_stack)>0 and left<res_stack[-1][0]:
                    mc = res_stack.pop()
                    mergeareasum += mc[1]
                    #res_stack.append((left,under[1]+area))
                else:
                    flag = False
                    res_stack.append((left,area+mergeareasum))
        else:
                res_stack.append((left,area))

ans=0
v_devided=[]
for pair in res_stack:
    ans += pair[1]
    v_devided.append(str(pair[1]))
print(ans)
if len(v_devided)>0:
    print(len(v_devided)," ".join(v_devided))
else:
    print(0)
