Consider thestring s to be the infinite wraparound stringof"abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".
Now we have another string p. Your job is to find out how many unique non-empty substrings of p are present in s. In particular, your input is thestring p and you need to output thenumberof different non-empty substrings of p inthestring s.
Note: p consists of only lowercase English letters andthe size of p might be over 10000.
Example 1:
Input: "a"
Output: 1
Explanation: Only the substring "a"ofstring"a" is inthestring s.
Example 2:
Input: "cac"
Output: 2
Explanation: There are two substrings "a", "c"ofstring"cac"inthestring s.
Example 3:
Input: "zab"
Output: 6
Explanation: There are six substrings "z", "a", "b", "za", "ab", "zab"ofstring"zab"inthestring s.
Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".Now we have anot