#include <bits/stdc++.h>
using namespace std;
int lcs(string s1,string s2){
   int n=s1.length();
   int m=s2.length();
    vector<vector<int>> mat(n+1,vector<int> m+1,0){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(s[i-1]==s2[j-1]){
                    mat[i][j]=mat[i-1]mat[j-1]+1;
                }
            }
            else{
                mat[i][j]=max(mat[i-1]mat[j],mat[i],mat[j-1]);
            }
        }
        return[n][m];
    }
}
int main(){
    string s1;
    string s1=s2;
    reverse(s2.begin(),s2.end());
    int k=lcs(s1,s2);
    cout<<k<<endl;
}