value = input();

j = 0
s = 0
n = len(value)
stack1 = list()
stack2 = []#[[[] for i in range(2)] for j in range(n)]
while(j < n):
    if value[j] == '\\':
        stack1.append(j)
    if value[j] == '/' :
        if len(stack1) != 0:
            idx1 = stack1[-1]
            idx2 = j
            stack2.append([idx1,idx2 - idx1])
            stack1.pop(-1)
            s += 1
    if s - 2 >= 0:
        if stack2[s-1][0] < stack2[s-2][0]:
            stack2[s-2][0] = stack2[s-1][0]
            stack2[s-2][1] += stack2[s-1][1]
            s -= 1
            stack2.pop(-1)
        
    j += 1

if s - 2 >= 0:
    for i in reversed(range(2, s+1)):
        if stack2[i-1][0] < stack2[i-2][0]:
            stack2[i-2][0] = stack2[i-1][0]
            stack2[i-2][1] += stack2[i-1][1]
            #s -= 1
            stack2.pop(i-1)


sumi = 0
s = len(stack2)
for i in range(0, s):
    sumi += stack2[i][1]
    
print(sumi)
if sumi == 0:
    print(s)
else:
    print(s, end = " ")

for i in range(0, s):
    if i != s - 1:
        print(stack2[i][1], end=" ")
    else:
        print(stack2[i][1])
 value = input() value input() input j = 0 j 0 s = 0 s 0 n = len(value) n len(value) len value stack1 = list() stack1 list() list stack2 = [] stack2 [] while(j < n):
    if value[j] == '\\':
        stack1.append(j)
    if value[j] == '/' :
        if len(stack1) != 0:
            idx1 = stack1[-1]
            idx2 = j
            stack2.append([idx1,idx2 - idx1])
            stack1.pop(-1)
            s += 1
    if s - 2 >= 0:
        if stack2[s-1][0] < stack2[s-2][0]:
            stack2[s-2][0] = stack2[s-1][0]
            stack2[s-2][1] += stack2[s-1][1]
            s -= 1
            stack2.pop(-1)
        
    j += 1 j < n j n if value[j] == '\\':
        stack1.append(j)
     value[j] == '\\' value[j] value j '\\' stack1.append(j) stack1.append stack1 append j if value[j] == '/' :
        if len(stack1) != 0:
            idx1 = stack1[-1]
            idx2 = j
            stack2.append([idx1,idx2 - idx1])
            stack1.pop(-1)
            s += 1
     value[j] == '/' value[j] value j '/' if len(stack1) != 0:
            idx1 = stack1[-1]
            idx2 = j
            stack2.append([idx1,idx2 - idx1])
            stack1.pop(-1)
            s += 1
     len(stack1) != 0 len(stack1) len stack1 0 idx1 = stack1[-1] idx1 stack1[-1] stack1 -1 idx2 = j idx2 j stack2.append([idx1,idx2 - idx1]) stack2.append stack2 append [idx1,idx2 - idx1] idx1 idx2 - idx1 idx2 idx1 stack1.pop(-1) stack1.pop stack1 pop -1 s += 1 s 1 if s - 2 >= 0:
        if stack2[s-1][0] < stack2[s-2][0]:
            stack2[s-2][0] = stack2[s-1][0]
            stack2[s-2][1] += stack2[s-1][1]
            s -= 1
            stack2.pop(-1)
        
     s - 2 >= 0 s - 2 s 2 0 if stack2[s-1][0] < stack2[s-2][0]:
            stack2[s-2][0] = stack2[s-1][0]
            stack2[s-2][1] += stack2[s-1][1]
            s -= 1
            stack2.pop(-1)
        
     stack2[s-1][0] < stack2[s-2][0] stack2[s-1][0] [s-1] stack2 s-1 s 1 0 stack2[s-2][0] [s-2] stack2 s-2 s 2 0 stack2[s-2][0] = stack2[s-1][0] stack2[s-2][0] [s-2] stack2 s-2 s 2 0 stack2[s-1][0] [s-1] stack2 s-1 s 1 0 stack2[s-2][1] += stack2[s-1][1] stack2[s-2][1] [s-2] stack2 s-2 s 2 1 stack2[s-1][1] [s-1] stack2 s-1 s 1 1 s -= 1 s 1 stack2.pop(-1) stack2.pop stack2 pop -1 j += 1 j 1 if s - 2 >= 0:
    for i in reversed(range(2, s+1)):
        if stack2[i-1][0] < stack2[i-2][0]:
            stack2[i-2][0] = stack2[i-1][0]
            stack2[i-2][1] += stack2[i-1][1]
            #s -= 1
            stack2.pop(i-1) s - 2 >= 0 s - 2 s 2 0 for i in reversed(range(2, s+1)):
        if stack2[i-1][0] < stack2[i-2][0]:
            stack2[i-2][0] = stack2[i-1][0]
            stack2[i-2][1] += stack2[i-1][1]
            #s -= 1
            stack2.pop(i-1) i reversed(range(2, s+1)) reversed range(2, s+1) range 2 s+1 s 1 if stack2[i-1][0] < stack2[i-2][0]:
            stack2[i-2][0] = stack2[i-1][0]
            stack2[i-2][1] += stack2[i-1][1]
            #s -= 1
            stack2.pop(i-1) stack2[i-1][0] < stack2[i-2][0] stack2[i-1][0] [i-1] stack2 i-1 i 1 0 stack2[i-2][0] [i-2] stack2 i-2 i 2 0 stack2[i-2][0] = stack2[i-1][0] stack2[i-2][0] [i-2] stack2 i-2 i 2 0 stack2[i-1][0] [i-1] stack2 i-1 i 1 0 stack2[i-2][1] += stack2[i-1][1] stack2[i-2][1] [i-2] stack2 i-2 i 2 1 stack2[i-1][1] [i-1] stack2 i-1 i 1 1 stack2.pop(i-1) stack2.pop stack2 pop i-1 i 1 sumi = 0 sumi 0 s = len(stack2) s len(stack2) len stack2 for i in range(0, s):
    sumi += stack2[i][1]
     i range(0, s) range 0 s sumi += stack2[i][1] sumi stack2[i][1] [i] stack2 i 1 print(sumi) print sumi if sumi == 0:
    print(s)
else:
    print(s, end = " ") sumi == 0 sumi 0 print(s) print s print(s, end = " ") print s end = " " end " " for i in range(0, s):
    if i != s - 1:
        print(stack2[i][1], end=" ")
    else:
        print(stack2[i][1]) i range(0, s) range 0 s if i != s - 1:
        print(stack2[i][1], end=" ")
    else:
        print(stack2[i][1]) i != s - 1 i s - 1 s 1 print(stack2[i][1], end=" ") print stack2[i][1] [i] stack2 i 1 end=" " end " " print(stack2[i][1]) print stack2[i][1] [i] stack2 i 1 stack2 = [] [] stack2 j = 0 0 j value = input() input() value s += 1 1 s j += 1 1 j s = len(stack2) len(stack2) s s -= 1 1 s s = 0 0 s sumi = 0 0 sumi sumi += stack2[i][1] stack2[i][1] sumi idx1 = stack1[-1] stack1[-1] idx1 idx2 = j j idx2 stack1 = list() list() stack1 n = len(value) len(value) n
value = input();

j = 0
s = 0
n = len(value)
stack1 = list()
stack2 = []#[[[] for i in range(2)] for j in range(n)]
while(j < n):
    if value[j] == '\\':
        stack1.append(j)
    if value[j] == '/' :
        if len(stack1) != 0:
            idx1 = stack1[-1]
            idx2 = j
            stack2.append([idx1,idx2 - idx1])
            stack1.pop(-1)
            s += 1
    if s - 2 >= 0:
        if stack2[s-1][0] < stack2[s-2][0]:
            stack2[s-2][0] = stack2[s-1][0]
            stack2[s-2][1] += stack2[s-1][1]
            s -= 1
            stack2.pop(-1)
        
    j += 1

if s - 2 >= 0:
    for i in reversed(range(2, s+1)):
        if stack2[i-1][0] < stack2[i-2][0]:
            stack2[i-2][0] = stack2[i-1][0]
            stack2[i-2][1] += stack2[i-1][1]
            #s -= 1
            stack2.pop(i-1)


sumi = 0
s = len(stack2)
for i in range(0, s):
    sumi += stack2[i][1]
    
print(sumi)
if sumi == 0:
    print(s)
else:
    print(s, end = " ")

for i in range(0, s):
    if i != s - 1:
        print(stack2[i][1], end=" ")
    else:
        print(stack2[i][1])

