自己写的找不到错误http://noi.openjudge.cn/ch0107/30/

#include
#include
int main() {
char s1[256],s2[256];
scanf("%s %s",s1,s2);
char ds1[520],ds2[520];
if(strlen(s1)
char temp[256];
strcpy(temp,s1);
strcpy(s1,s2);
strcpy(s2,temp);
}
strcpy(ds1,s1);
strcpy(ds2,s2);
strcat(ds1,s1);
strcat(ds2,s2);
int max=0,temp;
for(int i=0; i
for(int j=0; j
if(ds1[i]==ds2[j]) {
for(temp=0; temp
if((i+temp)>=strlen(ds1)||(j+temp)>=strlen(ds2)){
break;
}
else if(ds1[i+temp]==ds2[j+temp]) {
temp++;
}
else{
break;
}
}
if(max
max=temp;
}
}
}
}
printf("%d",max);
return 0;
}