kmp and lcs