31 lines
616 B
C++
31 lines
616 B
C++
#include<iostream>
|
|
using namespace std;
|
|
string a[100],s;
|
|
int ce(int now){
|
|
for(int i=0;i<now;i++){
|
|
//cout<<a[i]<<" "<<a[now]<<";";
|
|
if(a[i]==a[now]){
|
|
//cout<<endl;
|
|
return 0;
|
|
}
|
|
}
|
|
//cout<<endl;
|
|
return 1;
|
|
}
|
|
int main(){
|
|
int n;
|
|
cin>>n;
|
|
cin>>s;
|
|
for(int i=1;i<=n;i++){
|
|
int ge=0;
|
|
for(int j=i;j<=n;j++){
|
|
a[j-i]+=s[j-1];
|
|
ge+=ce(j-i);
|
|
//cout<<j<<" "<<a[j-i]<<" "<<ge<<endl;
|
|
}
|
|
if(ge==n-i+1){
|
|
cout<<i;
|
|
return 0;
|
|
}
|
|
}
|
|
} |