# -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 23:10:10 2018

@author: maezawa
"""

s = input()
n = len(s)

st = []
st2 = []
total_sum = 0

for i, c in enumerate(s):
    if c == '\\': # Back Slashをそのまま使うため二重にした。
        st.insert(0,i)
    elif c == '/' and len(st)>0: 
        j = st.pop(0)
        total_sum += i - j
        a = i - j
        while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
        st2.insert(0, [j, a])
        
print(total_sum)
print(len(st2), end='')
for i in reversed(range(len(st2))):
    print(" {}".format(st2[i][1]), end='')
print()


 """
Created on Sun Apr 29 23:10:10 2018

@author: maezawa
""" s = input() s input() input n = len(s) n len(s) len s st = [] st [] st2 = [] st2 [] total_sum = 0 total_sum 0 for i, c in enumerate(s):
    if c == '\\': # Back Slashをそのまま使うため二重にした。
        st.insert(0,i)
    elif c == '/' and len(st)>0: 
        j = st.pop(0)
        total_sum += i - j
        a = i - j
        while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
        st2.insert(0, [j, a])
         i c enumerate(s) enumerate s if c == '\\': # Back Slashをそのまま使うため二重にした。
        st.insert(0,i)
    elif c == '/' and len(st)>0: 
        j = st.pop(0)
        total_sum += i - j
        a = i - j
        while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
        st2.insert(0, [j, a])
         c == '\\' c '\\' st.insert(0,i) st.insert st insert 0 i elif c == '/' and len(st)>0: 
        j = st.pop(0)
        total_sum += i - j
        a = i - j
        while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
        st2.insert(0, [j, a])
         c == '/' and len(st)>0 c == '/' c '/' len(st)>0 len(st) len st 0 j = st.pop(0) j st.pop(0) st.pop st pop 0 total_sum += i - j total_sum i - j i j a = i - j a i - j i j while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
         len(st2) > 0 and st2[0][0] > j len(st2) > 0 len(st2) len st2 0 st2[0][0] > j st2[0][0] [0] st2 0 0 j a += st2.pop(0)[1] a st2.pop(0)[1] st2.pop(0) st2.pop st2 pop 0 1 st2.insert(0, [j, a]) st2.insert st2 insert 0 [j, a] j a print(total_sum) print total_sum print(len(st2), end='') print len(st2) len st2 end='' end '' for i in reversed(range(len(st2))):
    print(" {}".format(st2[i][1]), end='') i reversed(range(len(st2))) reversed range(len(st2)) range len(st2) len st2 print(" {}".format(st2[i][1]), end='') print " {}".format(st2[i][1]) " {}".format " {}" format st2[i][1] [i] st2 i 1 end='' end '' print() print j = st.pop(0) st.pop(0) j total_sum = 0 0 total_sum n = len(s) len(s) n a = i - j i - j a s = input() input() s st = [] [] st a += st2.pop(0)[1] st2.pop(0)[1] a total_sum += i - j i - j total_sum st2 = [] [] st2
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 23:10:10 2018

@author: maezawa
"""

s = input()
n = len(s)

st = []
st2 = []
total_sum = 0

for i, c in enumerate(s):
    if c == '\\': # Back Slashをそのまま使うため二重にした。
        st.insert(0,i)
    elif c == '/' and len(st)>0: 
        j = st.pop(0)
        total_sum += i - j
        a = i - j
        while len(st2) > 0 and st2[0][0] > j:
            a += st2.pop(0)[1]
        st2.insert(0, [j, a])
        
print(total_sum)
print(len(st2), end='')
for i in reversed(range(len(st2))):
    print(" {}".format(st2[i][1]), end='')
print()



