title: Intersection of char that go in a row
body: <p>I need to find the longest match with the entered words or numbers which go in a row.
  For example:</p>
  <pre><code>132 12332 12312 = 1
  ABCDEFGH ABCDEFG ABCEDF ABCED = ABC
  ABCDEFGH ABCDEFG ABCEDF ABCED = ABC
  ABCDEFGH ABCDEFG ABCDEF ABCDE = ABCDE
  ABCDEFGH ABCDEFG ABCDEF ABCDE EDCBA = A
  ABCDEFGH ABCDEFG ABCDEF ABCDE EDCBCA = BC
  ABCDEFGH ABCDEFG AxBCDEF ABCDxE EDCBCAABCD = BCD
  ABCDEFGH 1234 = 
  ABCDEFGH = ABCDEFGH
  </code></pre>