DFS C++| backtracking
class Solution {\npublic:\n    void dfs(string &s,int i,string &s1,string &s2,int &c){ \n       \n\t   if(i>=s.size()){\n            if(ispalindrome(s1) && ispa
class Solution {\npublic:\n    void dfs(string &s,int i,string &s1,string &s2,int &c){ \n       \n\t   if(i>=s.size()){\n            if(ispalindrome(s1) && ispalindrome(s2)){\n                int x = s1.size()*s2.size();\n                c = max(x,c);\n            }\n            return;\n        }\n        //not pic any \n        dfs(s,i+1,s1,s2,c);\n        \n        //pic in first string s1\n        s1.push_back(s[i]);\n        dfs(s,i+1,s1,s2,c);\n        s1.pop_back();\n        \n        //pic in second string s2\n        s2.push_back(s[i]);\n        dfs(s,i+1,s1,s2,c);\n        s2.pop_back();\n        \n    }\n    bool ispalindrome(string s){\n        int i = 0,j = s.size()-1;\n        while(i<j){\n            if(s[i]!=s[j]) return false;\n            i++;\n            j--;\n        }\n        return true;\n    }\n    int maxProduct(string s) {\n        string s1 = "",s2 = "";\n        int c = 0;\n        dfs(s,0,s1,s2,c);\n        return c;\n    }\n};
['Backtracking', 'Depth-First Search', 'C']