Thanksgiving Sale: Use Coupon Code THANKS25 to Get Extra 25% Off.
i to 0, j to 1, and k to 0.j + k is less than the length of the string s, do the following:
s[i + k] == s[j + k], increment k.s[i + k] < s[j + k], update i to max(i + k + 1, j), set j to i + 1, and reset k to 0.s[i + k] > s[j + k], update j to j + k + 1 and reset k to 0.i to the end of the string s.