c++ backtracking solution
\n\n#include<bits/stdc++.h>\nusing namespace std;\nint ans;\n\nbool ispal(string &s)\n{\n    int i = 0 , j = s.length() - 1;\n    while(i < j){\n        if(s[i]
```\n\n#include<bits/stdc++.h>\nusing namespace std;\nint ans;\n\nbool ispal(string &s)\n{\n    int i = 0 , j = s.length() - 1;\n    while(i < j){\n        if(s[i] != s[j]) return false;\n        ++i;\n        --j;\n    }\n    return true;\n}\n\nvoid solve(int index , string &s , string &s1, string &s2)\n{\n\n    /// add this char to s1 or s2 or skip.\n    if(ispal(s1) and ispal(s2))\n    {\n        int len1 = s1.length();\n        int len2 = s2.length();\n        int len  = len1 * len2;\n        ans = max(ans , len);\n    }\n    if(index == s.length()) return;\n    s1 = s1 + s[index];\n    solve(index + 1 , s , s1 , s2);\n    s1.pop_back();\n    s2 = s2 + s[index];\n    solve(index + 1, s , s1 , s2);\n    s2.pop_back();\n    solve(index + 1 , s , s1 , s2);\n}\n\nclass Solution {\npublic:\n    int maxProduct(string s) {\n        ans = 0;\n        string s1 = "" , s2 = "" ;\n        solve(0 , s, s1 , s2);\n        return ans; \n    }\n};\n\n```
[]