Longest Common Prefix Between Adjacent Strings After Removals
Precompute the prefix lengths of neighbouring words, then each removal only changes one new adjacent pair, found with prefix and suffix maxima.
Precompute the prefix lengths of neighbouring words, then each removal only changes one new adjacent pair, found with prefix and suffix maxima.