title: List sorting in python combine with string
body: <p>I have a string that goes like this
  string = &quot;CCB&quot;
  and a list</p>
  <p>list = ['C','C','B','CC']</p>
  <p>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</p>
  <p>list = ['C' , 'C ', 'CC' , 'B']</p>
  <p>I'm having some problem with this. does anyone have a python function or how to implement this problem?</p>