package com.company.test.最长重复子串;
/**
* @author xienl
* @description 最长重复子串
* @date 2022/9/13
*/
public class Solution {
public static void main(String[] args) {
Solution solution = new Solution();
}
public int solve (String a) {
// write code here
int maxLen = 0;
for (int i = 0; i < a.length(); i++){
for (int j = i; j < a.length(); j += 2){
if (judge(a.substring(i , j))){
maxLen = Math.max(maxLen, j - i);
}
}
}
return maxLen;
}
private boolean judge(String s ){
if (s.length() % 2 == 1){
return false;
}
return s.substring(0, s.length() / 2).equals(s.substring(s.length() / 2));
}
public int solve2 (String a) {
}
}