Concept Flow - Suffix arrays
Input String S
Generate all suffixes of S
Sort suffixes lexicographically
Store starting indices of sorted suffixes
Suffix Array constructed
Use suffix array for fast substring queries
Start with the input string, list all suffixes, sort them alphabetically, then record their starting positions to form the suffix array.