title: Filter list of strings, ignoring substrings of other items
body: <p>How can I filter through a list which containing strings and substrings to return only the longest strings. (If any item in the list is a substring of another, return only the longer string.)</p>
  
  <p>I have this function. Is there a faster way?</p>
  
  <pre><code>def filterSublist(lst):
      uniq = lst
      for elem in lst:
          uniq = [x for x in uniq if (x == elem) or (x not in elem)]
      return uniq
  
  lst = ["a", "abc", "b", "d", "xy", "xyz"]
  print filterSublist(lst)
  
  &gt; ['abc', 'd', 'xyz']
  &gt; Function time: 0.000011
  </code></pre>