Longest Common Subsequence
Print the length of the longest common subsequence of A and B.
Input: two lines: string A, then string B.
Output: the LCS length.
Constraints:
- 1 ≤ |A|, |B| ≤ 1000
- lowercase letters
Sample Tests
Input 1
abcde ace
Output 1
3
Input 2
abc def
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.