#include <iostream>
#include <cstring>
using namespace std;
int reversecmp_str(char *s1, char *s2, int &len) {
for (int i=0;i<len;i++) {
if (*(s1+i) != *(s2+len-1-i)) {
cout << "i=" << i << endl;
return 0;
}
}
return 1;
}
int compare_str(char *s1, char *s2, int &len) {
if (strncmp(s1, s2, len)!=0 ) {
if (reversecmp_str(s1, s2, len)) {
return 0;
}
return 1;
}
if (len%2!=0) return 2;
len>>=1;
strncpy(s2, s1+len, len);
return compare_str(s1, s2, len);
}
int main() {
char s[1024];
cin >>s;
int len = strlen(s);
char s1[512], s2[512];
len>>=1;
strncpy(s1, s, len);
strncpy(s2, s+len, len);
int ret = compare_str(s1, s2, len);
if (ret==0)
s[len] = 0;
else if (ret==1) {
len <<= 1;
s[len] == 0;
}
cout<<len<<endl;
return 0;
}
桃花长相依
拉丁的传说
相关分类