title: Find common substring between two strings
body: <p>I'd like to compare 2 strings and keep the matched, splitting off where the comparison fails.</p>
  <p>So if I have 2 strings:</p>
  <pre><code>string1 = &quot;apples&quot;
  string2 = &quot;appleses&quot;
  
  answer = &quot;apples&quot;
  </code></pre>
  <p>Another example, as the string could have more than one word:</p>
  <pre><code>string1 = &quot;apple pie available&quot;
  string2 = &quot;apple pies&quot;
  
  answer = &quot;apple pie&quot;
  </code></pre>
  <p>I'm sure there is a simple Python way of doing this but I can't work it out, any help and explanation appreciated.</p>