StringTools[LongestCommonSubString] - return the longest common substring of two strings
StringTools[LongestCommonSubSequence] - return the longest common subsequence of two strings
|
Calling Sequence
|
|
LongestCommonSubString( s1, s2 )
LongestCommonSubSequence( s1, s2 )
|
|
Parameters
|
|
s1
|
-
|
Maple string
|
s2
|
-
|
Maple string
|
|
|
|
|
Description
|
|
•
|
The LongestCommonSubString(s1, s2) command returns from its input strings, s1 and s2, a common substring of maximum length.
|
•
|
Many common substrings of maximum length may exist. Which among the candidates is returned depends upon the suffix structure of the pair of strings, but is deterministic.
|
•
|
The LongestCommonSubSequence(s1, s2) command is similar, but searches for subsequences of the pair of input strings rather than substrings.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
>
|
|
>
|
|
| (7) |
>
|
|
| (8) |
|
|
Download Help Document
Was this information helpful?