Help me understand where i was wrong in this question

I have coded a solution using dynamic programming approach for this question
Question Link. It is giving me failed test case, is there anything wrong in my approach

class Solution{
    public:
    void jawab(){
        int n;
        cin>>n;
        string a;
        cin>>a;
        string b = a;
        reverse(b.begin(),b.end());
        vector<vector<int>> tab(n+1,vector<int>(n+1));
        for(int i=0;i<=n;i++){
            tab[i][n]=0;
            tab[n][i]=0;
        }
        int maxi = 0;
        for(int i=n-1;i>=0;i--){
            for(int j=n-1;j>=0;j--){
                tab[i][j]=tab[i+1][j+1];
                if(a[i]==b[j]){
                    tab[i][j]+=1;
                }
                maxi = max(maxi,tab[i][j]);
            }
        }
        cout<<maxi;
    }
};