LCS function

LCS: Largest consistent subset