Longest substring (for sequences of triplets) <p>I am trying to compare strings of the format: AAA-ABC-LAP-ASZ-ASK; basically, triplets of letters separated by dashes.</p> <p>I'm trying to find between 2 such sequences of arbitrary length (from 1 to 30 triplets) the longest sequence of common triplets.</p> <p>For example, AAA-BBB-CCC-AAA-DDD-EEE-BBB and BBB-AAA-DDD-EEE-BBB, you can find a sequence of 5 (BBB-AAA-DDD-EEE-BBB, even if CCC is not present in the 2nd sequence).</p> <p>The dashes should not be considered for comparison; they only serve to separate the triplets.</p> <p>I'm using Python but just a general algorithm to achieve this should do :)</p>