#include<iostream>
#include<string>
using namespace std
;
bool periodic(string s
,string sub
){
int lensub
= sub
.length();
int lens
= s
.length();
for(int i
= 0;i
< s
.length();i
++){
if(s
[i
] != sub
[i
% lensub
])
return false;
}
return true;
}
int main(){
string s
;
string sub
;
cin
>>s
;
int i
;
for(i
= 1;i
< s
.length();i
++){
sub
= s
.substr(0,i
);
if(periodic(s
,sub
) == true){
cout
<<sub
<<endl
;
break;
}
}
return 0;
}
转载请注明原文地址:https://tech.qufami.com/read-7600.html