Unique Substrings in Wraparound String
We define the string base to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so base will look like this:
"...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd...."
Given a string s, return the number of unique non-empty substrings of s that are present in base.
Example 1
Input
s = "a"Output
1Only the substring "a" of
s is in base.Example 2
Input
s = "cac"Output
2There are two substrings ("a", "c") of
s in base.Constraints
- 1 <= s.length <= 10^5
- s consists of lowercase English letters.