longest_common_subsequence 函数
返回两个字符串共有的一个最长有序子序列,字符不必相邻。
语法
LongestCommonSubSequence(text1, text2)StringTools:-LongestCommonSubSequence(text1, text2)longest_common_subsequence(text1, text2)
参数与选项
text1 | 第一个文本值。 |
|---|---|
text2 | 第二个文本值。 |
示例
- 有序公共子序列
LongestCommonSubSequence('abcdef', 'azced')返回 acd。 - 包调用形式
StringTools:-LongestCommonSubSequence('ABCBDAB', 'BDCABA')返回 BCBA。