Brute Force Appro
\n\n# Code\n\nclass Solution:\n    def maxProduct(self, s: str) -> int:\n        N,pali = len(s),{} # bitmask = length\n\n        for mask in range(1,1<<N): # 1
\n\n# Code\n```\nclass Solution:\n    def maxProduct(self, s: str) -> int:\n        N,pali = len(s),{} # bitmask = length\n\n        for mask in range(1,1<<N): # 1 << N == 2**N\n            subseq = ""\n            for i in range(N):\n                if mask & (1<<i):\n                    subseq+=s[i]\n\n            if subseq == subseq[::-1]:\n                pali[mask] = len(subseq)\n\n            \n        res = 0\n        for m1 in pali:\n            for m2 in pali:\n                if m1 & m2 == 0:\n                    res = max(res,pali[m1]*pali[m2])\n\n        return res\n\n\n```
['Python3']