Description
Return the number of distinct non-empty substrings of s that can be written as the concatenation of some string with itself.
Examples
Input:
text = "abcabcabc"Output:
3Explanation:
abcabc, bcabca, cabcab.
Input:
text = "a"Output:
0Explanation:
Edge case with a single character.
Input:
text = "aabaabaa"Output:
2Explanation:
The 2 distinct echo substrings are "aabaab" (aab+aab) and "abaaba" (aba+aba).
Constraints
- •
1 ≤ text.length ≤ 2000