Python Simple Soln(Brute Force)
\n    def maxProduct(self, s: str) -> int:\n        def largestP(s):\n            n = len(s)\n            dp = [1] * n\n            for j in range(1, len(s)):\n
```\n    def maxProduct(self, s: str) -> int:\n        def largestP(s):\n            n = len(s)\n            dp = [1] * n\n            for j in range(1, len(s)):\n                pre = dp[j]\n                for i in reversed(range(0, j)):\n                    tmp = dp[i]\n                    if s[i] == s[j]:\n                        dp[i] = 2 + pre if i + 1 <= j - 1 else 2\n                    else:\n                        dp[i] = max(dp[i + 1], dp[i])\n                    pre = tmp\n            return dp[0]\n        \n        l = len(s)\n        output = 1\n        for i in range(1, (2**(l-1)):\n            r = \'\'\n            m = \'\'\n            for j in range(l):\n                if i & (1<< j):\n                    r += s[j]\n                else:\n                    m += s[j]\n            output = max((largestP(r) * largestP(m)), output)\n        return output\n            \n```
['Dynamic Programming', 'Iterator']