We’re preparing your current view and syncing the latest data.
Given a string s, determine if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Return true if it can be constructed in this way, otherwise return false.
A single string s.
Return true if s can be constructed by repeating a substring multiple times; otherwise return false.
1 <= s.length <= 10^4 s consists of lowercase English letters.
Example 1
Input
"abab"
Output
true
Explanation
The string "abab" is made by repeating "ab" twice.
Example 2
Input
"aba"
Output
false
Explanation
The string "aba" cannot be constructed by repeating any of its substrings multiple times.
Example 3
Input
"abcabcabcabc"
Output
true
Explanation
The string is made by repeating "abc" four times.