title: Python finding the common parts of a string throughout a list and removing it from every item
body: <p>I have a list of file directories that looks similar to this:</p>
  
  <pre><code>path/new/stuff/files/morefiles/A/file2.txt
  path/new/stuff/files/morefiles/B/file7.txt
  path/new/stuff/files/morefiles/A/file1.txt
  path/new/stuff/files/morefiles/C/file5.txt
  </code></pre>
  
  <p>I am trying to remove the <strong>beginnings</strong> of the paths that are the <strong>same</strong> from every list, and then deleting that from each file.</p>
  
  <p>The list can be any length, and in the example I would be trying to change the list into:</p>
  
  <pre><code>A/file2.txt
  B/file7.txt
  A/file1.txt
  C/file5.txt
  </code></pre>
  
  <p>Methods like <code>re.sub(r'.*I', 'I', filepath)</code> and <code>filepath.split('_', 1)[-1]</code> can be used for the replacing, but I'm not sure about how to find the common parts in the list of filepaths</p>
  
  <p>Note:</p>
  
  <p>I am using Windows and python 3</p>