import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
* @param a string字符串 待计算字符串
* @return int整型
*/
public int solve (String a) {
// write code here
int len = a.length();
if (len < 2) {
return 0;
}
int res = 0;
for (int i = 0; i < len - 1; i++) {
int mid = ((len + i) >> 1);
for (int j = mid; j > i; j--) {
String str1 = a.substring(i, j);
String str2 = a.substring(j, j + (j - i));
if (str1.equals(str2)) {
res = Math.max(res, str1.length());
break;
}
}
}
return res * 2;
}
}