inputs = list(input())
stack = []
L = []
tmp_total = 0
counter = 0
upper = 0
for i,x in enumerate(inputs):
    if(x == '\\'):
        stack.append(i)
    elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer))

print(sum([j[1] for j in L]))
if(len(L) != 0):
    print(str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L]))
else:
    print(str(len(L)))
 inputs = list(input()) inputs list(input()) list input() input stack = [] stack [] L = [] L [] tmp_total = 0 tmp_total 0 counter = 0 counter 0 upper = 0 upper 0 for i,x in enumerate(inputs):
    if(x == '\\'):
        stack.append(i)
    elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer)) i x enumerate(inputs) enumerate inputs if(x == '\\'):
        stack.append(i)
    elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer)) x == '\\' x '\\' stack.append(i) stack.append stack append i elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer)) (x == '/') and stack x == '/' x '/' stack tmp = stack.pop() tmp stack.pop() stack.pop stack pop total_layer = i-tmp total_layer i-tmp i tmp if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
         L while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
         L and L[-1][0] > tmp L L[-1][0] > tmp L[-1][0] [-1] L -1 0 tmp cal = L.pop() cal L.pop() L.pop L pop total_layer += cal[1] total_layer cal[1] cal 1 L.append((i, total_layer)) L.append L append (i, total_layer) i total_layer j[1] for j in L for j in L j L for j in L j[1] j 1 print(sum([j[1] for j in L])) print sum([j[1] for j in L]) sum [j[1] for j in L] if(len(L) != 0):
    print(str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L]))
else:
    print(str(len(L))) len(L) != 0 len(L) len L 0 str(i[1]) for i in L for i in L i L for i in L str(i[1]) str i[1] i 1 print(str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L])) print str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L]) str(len(L))+ ' ' str(len(L)) str len(L) len L ' ' ' '.join([str(i[1]) for i in L]) ' '.join ' ' join [str(i[1]) for i in L] print(str(len(L))) print str(len(L)) str len(L) len L tmp_total = 0 0 tmp_total counter = 0 0 counter stack = [] [] stack tmp = stack.pop() stack.pop() tmp inputs = list(input()) list(input()) inputs total_layer = i-tmp i-tmp total_layer L = [] [] L upper = 0 0 upper total_layer += cal[1] cal[1] total_layer cal = L.pop() L.pop() cal
inputs = list(input())
stack = []
L = []
tmp_total = 0
counter = 0
upper = 0
for i,x in enumerate(inputs):
    if(x == '\\'):
        stack.append(i)
    elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer))

print(sum([j[1] for j in L]))
if(len(L) != 0):
    print(str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L]))
else:
    print(str(len(L)))

