Side Note:
Given 2 strings (text, pattern).
Print all the positions of the pattern's occurrences within the text.
Example:
ababab ab
Output:
3
1 3 5
The Longest Proper-Suffix that's also a Proper-Prefix
F[i] = 0 1 0 1 2 3
S = a a b a a b
i = 0 1 2 3 4 5
F[i] = 0 1 0 1 2 ?
S = a a b a a x
i = 0 1 2 3 4 5
F[i] = 0 1 0 1 2 ?
S = a a b a a a
i = 0 1 2 3 4 5
F[i] = 0 1 0 1 2 ?
S = a a b a a b
i = 0 1 2 3 4 5
F[i] = 0 1 0 1 2 0
S = a a b a a x
i = 0 1 2 3 4 5
F[i] = 0 1 0 1 2 2
S = a a b a a a
i = 0 1 2 3 4 5