C++ || LPS and Brute Force
upvote if you find it helpful :)\n\nclass Solution {\npublic:\n    \n    int LPS(string s){ //To find the longest palindrome of a given string\n        \n      
***upvote if you find it helpful :)***\n```\nclass Solution {\npublic:\n    \n    int LPS(string s){ //To find the longest palindrome of a given string\n        \n        if( s.size() == 1 ) return 1;\n        int n = s.size();\n        int dp[n][n];\n        memset(dp,0,sizeof(dp));\n        \n        for(int i = 0; i < n; i++) dp[i][i]=1;\n         \n        for(int i = 1; i < n; i++){\n            for(int j = 0,k = i; j < n-i; j++){\n                k = i+j;\n                if( s[j] == s[k] )\n                    dp[j][k] = dp[j+1][k-1]+2;\n                else\n                    dp[j][k] = max(dp[j][k-1],dp[j+1][k]);\n            }\n        }\n        \n        return dp[0][n-1];\n    }\n    int maxProduct(string s) {\n        int ans = 0, len = s.size();\n        // Generate all subsequences of the String\n        for(int i = 1; i < pow(2,len-1); i++){\n            string p = "", q = "";\n            for(int j = 0; j < len; j++){\n                if( i & 1<<j ) p+=s[j];\n                else q+=s[j];\n            }\n            ans = max(ans, LPS(p)*LPS(q));\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']