Adjacent-suffix characterization of longest repeats (source code)

= Adjacent-suffix characterization of longest repeats

The length of a <longest repeated substring> equals the maximum longest-common-prefix length over adjacent suffixes in <lexicographic order>. Suffixes beginning with a fixed <string> form a consecutive interval: a <string> outside that <string prefix> <software class> differs earlier or ends sooner, putting it strictly to one side. Two occurrences of a <longest repeated substring> therefore bound an interval in which every adjacent pair shares that <string prefix>. At least one adjacent pair attains its length, and no pair can exceed the global maximum. This proves the result even when occurrences overlap; a text with fewer than two suffixes needs a separate empty-result convention.