Python Bitmask
\ndef maxProduct(self, s: str) -> int:\n        mem = {}\n        n = len(s)\n        for i in range(1,1<<n):\n            tmp = ""\n            for j in range(
```\ndef maxProduct(self, s: str) -> int:\n        mem = {}\n        n = len(s)\n        for i in range(1,1<<n):\n            tmp = ""\n            for j in range(n):\n                if i>>j & 1 == 1:\n                    tmp += s[j]\n            if tmp == tmp[::-1]:\n                mem[i] = len(tmp)\n        res = 0\n        for i,x in mem.items():\n            for j,y in mem.items():\n                if i&j == 0:\n                    res = max(res,x*y)\n        return res\n```
[]