private long cal(){
        int length = subLength*2;
        long[][][] dp = new long[length+1][subLength+1][subLength+1];
        dp[0][0][0] = 1;

        for(int k=1; k<=length; k++){
            for(int i=0; i<=subLength; i++){
                int j = k-i;
                if(j<0) break;
                if(j<=subLength){
                    if(i>0 && string[k-1] == generated[i-1]) dp[k][i][j] += dp[k-1][i-1][j];
                    if(j>0 && string[k-1] == generated[j-1]) dp[k][i][j] += dp[k-1][i][j-1];
                    dp[k][i][j] = dp[k][i][j];
                }
            }
        }
        return dp[length][subLength][subLength];
    }