title: What is the Pythonic way to find the longest common prefix of a list of lists?
body: <p><strong>Given</strong>:  a list of lists, such as <code>[[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]]</code></p>
  
  <p><strong>Todo</strong>:   Find the longest common prefix of all sublists.</p>
  
  <p><strong>Exists</strong>: In another thread "<a href="https://stackoverflow.com/questions/2727650/common-elements-between-two-lists-not-using-sets-in-python">Common elements between two lists not using sets in Python</a>", it is suggested to use "Counter", which is available above python 2.7. However our current project was written in python 2.6, so "Counter" is not used.</p>
  
  <p><strong>I currently code it like this:</strong></p>
  
  <pre><code>l = [[3,2,1], [3,2,1,4,5], [3,2,1,8,9], [3,2,1,5,7,8,9]]
  newl = l[0]
  if len(l)&gt;1:
      for li in l[1:]:
      newl = [x for x in newl if x in li]
  </code></pre>
  
  <p>But I find it not very pythonic, is there a better way of coding?</p>
  
  <p>Thanks!</p>
  
  <p><strong>New edit</strong>: Sorry to mention: in my case, the shared elements of the lists in 'l' have the same order and alway start from the 0th item. So you wont have cases like <code>[[1,2,5,6],[2,1,7]]</code></p>