class Solution {
public:
bool repeatedSubstringPattern(string s) {
int len=s.size();
for(int i=1;i<=len/2;i++){
if(len%i==0){
bool match=true;
for(int j=i;j<len;j++){
if(s[j]!=s[j-i]){
match=false;
break;
}
}
if(match){
return true;
}
}
}
return false;
}
};
官方题解