Description
Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Return true if so, false otherwise.
Examples
Input:
s = "abab"Output:
trueExplanation:
ab repeated twice forms abab.
Input:
s = "aba"Output:
falseExplanation:
No repeated substring can form "aba". The possible substrings "a" and "ab" do not produce "aba" when repeated.
Input:
s = "abcabcabcabc"Output:
trueExplanation:
The substring "abc" repeated 4 times produces "abcabcabcabc".
Constraints
- •
1 ≤ s.length ≤ 10⁴