显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int n,k = 0;
char a[110];
bool f;
bool sou(int x){
int l = 0;
for(int j = x;j <= x+k;j++,l++){
if(a[l] != a[j])return 0;
}
return 1;
}
int main(){
freopen("whereami.in","r",stdin);
freopen("whereami.out","w",stdout);
scanf("%d%s",&n,&a);
while(k < n){
f = 0;
for(int i = k+1;i <= n-k-1;i++){
if(sou(i) == 1){
f = 1;
break;
}
}
if(f == 0){
printf("%d\n",k+1);
return 0;
}
k++;
}
return 0;
}