Python DFS solution
We have 3 possibilities i.e, \n1) not considering the current char for either subsequence \n2) considering it for first one \n3) considering it for second subse
We have 3 possibilities i.e, \n1) not considering the current char for either subsequence \n2) considering it for first one \n3) considering it for second subsequence\n[Follow here](https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences/discuss/1458482/PYTHON-Simple-solution-backtracking)\n```\nclass Solution:\n    def maxProduct(self, s: str) -> int:\n        self.res = 0\n        def isPalindrome(word):\n            l, r = 0, len(word)-1\n            while l < r:\n                if word[l] != word[r]:\n                    return False\n                l += 1; r -= 1\n            return True\n        \n        @functools.lru_cache(None)\n        def dfs(i, word1, word2):\n            if i >= len(s):\n                if isPalindrome(word1) and isPalindrome(word2):\n                    self.res = max(self.res, len(word1) * len(word2))\n                return\n            \n\t\t\tdfs(i + 1, word1, word2)             # 1st case \n            dfs(i + 1, word1 + s[i], word2)    # 2nd case\n            dfs(i + 1, word1, word2 + s[i])    # 3rd case\n            \n        dfs(0, \'\', \'\')\n\t\t\n        return self.res\n```
['Depth-First Search', 'Recursion', 'Memoization', 'Python']