# PDF参考
# スタックS1
S1 = []
# スタックS2
S2 = []
tmp_total = 0
counter = 0
upper = 0
# 総面積
total_layer = 0

for i,symbol in enumerate(input()):
    if (symbol == '\\'):
        S1.append(i)
    elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer))
print(sum([j[1] for j in S2]))
if (len(S2) != 0):
    print(str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2]))
else:
    print(str(len(S2)))
        
 S1 = [] S1 [] S2 = [] S2 [] tmp_total = 0 tmp_total 0 counter = 0 counter 0 upper = 0 upper 0 total_layer = 0 total_layer 0 for i,symbol in enumerate(input()):
    if (symbol == '\\'):
        S1.append(i)
    elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer)) i symbol enumerate(input()) enumerate input() input if (symbol == '\\'):
        S1.append(i)
    elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer)) symbol == '\\' symbol '\\' S1.append(i) S1.append S1 append i elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer)) (symbol == '/') and S1 symbol == '/' symbol '/' S1 i_p = S1.pop() i_p S1.pop() S1.pop S1 pop total_layer = i - i_p total_layer i - i_p i i_p if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
         S2 while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
         S2 and S2[-1][0] > i_p S2 S2[-1][0] > i_p S2[-1][0] [-1] S2 -1 0 i_p cal = S2.pop() cal S2.pop() S2.pop S2 pop total_layer += cal[1] total_layer cal[1] cal 1 S2.append((i, total_layer)) S2.append S2 append (i, total_layer) i total_layer j[1] for j in S2 for j in S2 j S2 for j in S2 j[1] j 1 print(sum([j[1] for j in S2])) print sum([j[1] for j in S2]) sum [j[1] for j in S2] if (len(S2) != 0):
    print(str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2]))
else:
    print(str(len(S2)))
         len(S2) != 0 len(S2) len S2 0 str(i[1]) for i in S2 for i in S2 i S2 for i in S2 str(i[1]) str i[1] i 1 print(str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2])) print str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2]) str(len(S2)) + ' ' str(len(S2)) str len(S2) len S2 ' ' ' '.join([str(i[1]) for i in S2]) ' '.join ' ' join [str(i[1]) for i in S2] print(str(len(S2))) print str(len(S2)) str len(S2) len S2 S1 = [] [] S1 total_layer = i - i_p i - i_p total_layer tmp_total = 0 0 tmp_total upper = 0 0 upper cal = S2.pop() S2.pop() cal i_p = S1.pop() S1.pop() i_p S2 = [] [] S2 total_layer = 0 0 total_layer counter = 0 0 counter total_layer += cal[1] cal[1] total_layer
# PDF参考
# スタックS1
S1 = []
# スタックS2
S2 = []
tmp_total = 0
counter = 0
upper = 0
# 総面積
total_layer = 0

for i,symbol in enumerate(input()):
    if (symbol == '\\'):
        S1.append(i)
    elif (symbol == '/') and S1:
        i_p = S1.pop()
        total_layer = i - i_p
        if S2 :
            while S2 and S2[-1][0] > i_p:
                cal = S2.pop()
                total_layer += cal[1]
        S2.append((i, total_layer))
print(sum([j[1] for j in S2]))
if (len(S2) != 0):
    print(str(len(S2)) + ' ' + ' '.join([str(i[1]) for i in S2]))
else:
    print(str(len(S2)))
        

