Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


finds the longest sequence of contiguous or disjoint elements common to the strings or lists and and returns their positions.

Details and OptionsDetails and Options

  • LongestCommonSequencePositions[s1,s2] returns an expression of the form where the specify the positions of the longest common sequence in the strings or lists .
  • For lists , Take[si,posi] returns the longest common sequence. For strings , StringTake[si,posi] returns the longest common contiguous or disjoint substring.
  • If there are several common sequences of the same length, LongestCommonSequencePositions returns the one that begins earliest in .
  • For strings, setting the option IgnoreCase->True makes LongestCommonSequencePositions treat lowercase and uppercase letters as equivalent, and returns the form of common sequence that occurs in .
Introduced in 2015