[C++] Simple C++ Code
\n\n# If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n   
\n\n# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    int n, ans = -1;\n    bool isPalindrome(string &p)\n    {\n        int i = 0, j = p.size()-1;\n        while(i <= j)\n        {\n            if(p[i] == p[j])\n            {\n                i++;\n                j--;\n            }\n            else\n                return false;\n        }\n        return true;\n    }\n    void dfs(string &s, string &a, string &b, int idx)\n    {\n        if(idx == n)\n        {\n            if(isPalindrome(a) && isPalindrome(b)){\n                int val = a.size()*b.size();\n                ans = max(val, ans);\n            }\n            return;\n        }\n        a.push_back(s[idx]);\n        dfs(s, a, b, idx+1);\n        a.pop_back();\n        b.push_back(s[idx]);\n        dfs(s, a, b, idx+1);\n        b.pop_back();\n        dfs(s, a, b, idx+1);\n    }\npublic:\n    int maxProduct(string s) {\n        n = s.size();\n        string a = "", b = "";\n        dfs(s, a, b, 0);\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'Backtracking', 'Recursion', 'C']