class Solution {
public:
int solve(string a) {
int n = a.length();
int res = 0;
for(int i = n / 2; i > 0; --i) {//枚举长度
for(int j = 0; j < n - i; ++j) {//枚举起点
if(a[j] == a[j + i])
res++;
else
res = 0;
if(res == i)
return res * 2;
}
}
return res;
}
};