public String longestPalindrome(String s) {
        if(s == null || s.isEmpty()) return s;
        int len = s.length();
        boolean [][] DP = new boolean[len][len];
        String [] res = new String[len];
        int resL = -1;
        int resS = 0;
        for(int l = 0; l < len; ++l){
            for(int i = 0; i + l < len; ++i){
                if(l <= 1){
                    DP[i][l+i] = s.charAt(i) == s.charAt(l+i);
                }else {
                    DP[i][l+i] = (s.charAt(i) == s.charAt(l+i)) ? DP[i+1][l+i-1] : false;
                }
                if(DP[i][l+i] && l+1 >= resL){
                    resL = l+1;
                    resS = i;
                }
            }
        }
        return s.substring(resS, resS+resL);
    }