C++ bitmask, hashmap
If the string is n chars long, every possible string can be created in a loop from 0-2^n,\nthe same way you generate all subsets. \n\nCreate the strings and rev
If the string is n chars long, every possible string can be created in a loop from 0-2^n,\nthe same way you generate all subsets. \n\nCreate the strings and reverse them, if its equal its a palidrome.\n\nThe binary version of the numbers in the loop from 0-2^n represents the char positions of each string created, store the palidromes with the outer loop number being the key, and the amount of bits being the value.\n\nLoop through the map in, and \'&\' each key value, if its 0, then they dont have any same bits, multiply them and keep track od the maximum.\n\n\n```\nclass Solution {\npublic:\n    int maxProduct(string s) {\n        unordered_map <int, int> map;\n        int n = s.size();\n        for (int i = 0; i < (1 << n); i++) {\n            string str = "";\n            for (int j = 0; j < n; j++) {\n                if ((i & (1 << j))) {\n                    str += s[j];\n                }\n            }\n            string str1(str);  \n            reverse(str.begin(), str.end());\n            if (str == str1) {\n                map[i] = __builtin_popcount(i);\n            }\n        }\n        int maxNum = 0;\n        for (pair<int,int> i: map) {\n            for (pair<int, int> j : map) {\n                if (i != j) {\n                    if ((i.first & j.first) == 0) {\n                        maxNum = max((i.second * j.second), maxNum);\n                    }\n                }\n            }\n        }\n        return maxNum;\n    }\n};\n```
['Bit Manipulation', 'C']