Given two strings text1 and text2, return the length of their longest common subsequence (LCS). If there is no common subsequence, return 0.
A subsequence is a sequence derived from a string by deleting some characters (or none) without changing the relative order of the remaining characters.
A common subsequence is a subsequence that appears in both strings.
Input: text1 = "abcde", text2 = "ace" Output: 3 Explanation: The longest common subsequence is "ace", which has length 3.
Input: text1 = "abc", text2 = "abc" Output: 3 Explanation: The strings are identical so the LCS is "abc" itself, length 3.
Input: text1 = "abc", text2 = "def" Output: 0 Explanation: No character appears in both strings, so there is no common subsequence.
text1 = "abcde", text2 = "ace"