updated and added LCS algorithm