LCS: add tests, and fix one bug
LCS: add one more test
LCS: some refactorization