I have a string that goes like this string = "CCB" and a list
list = ['C','C','B','CC']
How do i sort them by their appearance order in the string (high priority) and their length(lower priority). After sorted the list should be like this
list = ['C' , 'C ', 'CC' , 'B']
I'm having some problem with this. does anyone have a python function or how to implement this problem?