title: Longest common contiguous subsequence - algorithm
body: <p>My question is simple: Is there an O(n) algorithm for finding the longest contiguous subsequence between two sequences A and B? I searched it, but all the results were about the LCS problem, which is not what I'm seeking.</p>
  
  <p><em>Note:</em> if you are willing to give any sample code, you are more than welcome to do so, but please, if you can, in C or C++.</p>
  
  <p><em>Edit:</em> Here is an example:</p>
  
  <pre><code>A: { a, b, a, b, b, b, a }
  B: { a, d, b, b, b, c, n }
  longest common contiguous subsequence: { b, b, b }
  </code></pre>