Suffix array
Sort all the endings of a word alphabetically. An ending starts at any letter and runs to the end. Endings that start alike sit together, which helps you look up a piece of the word.
Each position starts a suffix. First sort by one character. Counting sort orders pairs of previously known ranks, doubling the compared length each round. The result lists suffix start positions.