s1 = []   #/????????????????????§??????????????????
s2 = []   #??????????°´??????????????¢??????[????????????\???????????????????°´??????????????¢???]?????¢??§????????§??????????????????
su = 0   #?????¢???

st = list(input())   #??\?????????????????????????´????????????????

for i in range(len(st)):   #???????????????????????????????????£????????¢????¨????
    if st[i] == '\\':
        s1.append(i)
    elif st[i] == '/' and len(s1) != 0:
        left = s1.pop()
        su += i - left
        area = 0
        while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
        s2.append([left,area + i -left])

print(su)
print(' '.join([str(len(s2))] + [str(i[1]) for i in s2])) s1 = [] s1 [] s2 = [] s2 [] su = 0 su 0 st = list(input()) st list(input()) list input() input for i in range(len(st)):   #???????????????????????????????????£????????¢????¨????
    if st[i] == '\\':
        s1.append(i)
    elif st[i] == '/' and len(s1) != 0:
        left = s1.pop()
        su += i - left
        area = 0
        while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
        s2.append([left,area + i -left]) i range(len(st)) range len(st) len st if st[i] == '\\':
        s1.append(i)
    elif st[i] == '/' and len(s1) != 0:
        left = s1.pop()
        su += i - left
        area = 0
        while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
        s2.append([left,area + i -left]) st[i] == '\\' st[i] st i '\\' s1.append(i) s1.append s1 append i elif st[i] == '/' and len(s1) != 0:
        left = s1.pop()
        su += i - left
        area = 0
        while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
        s2.append([left,area + i -left]) st[i] == '/' and len(s1) != 0 st[i] == '/' st[i] st i '/' len(s1) != 0 len(s1) len s1 0 left = s1.pop() left s1.pop() s1.pop s1 pop su += i - left su i - left i left area = 0 area 0 while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
         len(s2) != 0 and left < s2[-1][0] len(s2) != 0 len(s2) len s2 0 left < s2[-1][0] left s2[-1][0] [-1] s2 -1 0 area += s2.pop()[1] area s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([left,area + i -left]) s2.append s2 append [left,area + i -left] left area + i -left area + i area i left print(su) print su 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(' '.join([str(len(s2))] + [str(i[1]) for i in s2])) print ' '.join([str(len(s2))] + [str(i[1]) for i in s2]) ' '.join ' ' join [str(len(s2))] + [str(i[1]) for i in s2] [str(len(s2))] str(len(s2)) str len(s2) len s2 [str(i[1]) for i in s2] su += i - left i - left su s2 = [] [] s2 area += s2.pop()[1] s2.pop()[1] area su = 0 0 su st = list(input()) list(input()) st left = s1.pop() s1.pop() left s1 = [] [] s1 area = 0 0 area
s1 = []   #/????????????????????§??????????????????
s2 = []   #??????????°´??????????????¢??????[????????????\???????????????????°´??????????????¢???]?????¢??§????????§??????????????????
su = 0   #?????¢???

st = list(input())   #??\?????????????????????????´????????????????

for i in range(len(st)):   #???????????????????????????????????£????????¢????¨????
    if st[i] == '\\':
        s1.append(i)
    elif st[i] == '/' and len(s1) != 0:
        left = s1.pop()
        su += i - left
        area = 0
        while len(s2) != 0 and left < s2[-1][0]:
            area += s2.pop()[1]
        s2.append([left,area + i -left])

print(su)
print(' '.join([str(len(s2))] + [str(i[1]) for i in s2]))