title: How to find maximum overlap between two strings in Scala?
body: <p>Suppose I have two strings: <code>s</code> and <code>t</code>. I need to write a function <code>f</code> to find a max. <code>t</code> prefix, which is also an <code>s</code> suffix. For example:</p>
  
  <pre><code> s = "abcxyz", t = "xyz123", f(s, t) = "xyz"
   s = "abcxxx", t = "xx1234", f(s, t) = "xx"
  </code></pre>
  
  <p>How would you write it in Scala ?</p>