Updated to extract the LCS as well as calculate its distance.

No additional quadratic memory is required, just a single stack.