My Java Solution using recursion
\nclass Solution {\n    \n    private int maxProduct = -1;\n    \n    public int maxProduct(String s) {\n        if (s == null || s.length() <= 1) {\n          
```\nclass Solution {\n    \n    private int maxProduct = -1;\n    \n    public int maxProduct(String s) {\n        if (s == null || s.length() <= 1) {\n            return 0;\n        }\n        int length = s.length();\n        if (length == 1) {\n            return 1;\n        }\n        List<Character> word1 = new ArrayList<>();\n        List<Character> word2 = new ArrayList<>();\n        recursionHelper(s, 0, word1, word2);\n        return maxProduct;\n    }\n    \n    public void recursionHelper(String s, int currentIndex, List<Character> word1, List<Character> word2) {\n        if (currentIndex >= s.length()) {\n            // update the maxProduct by checking the palindrome\n            if (isPalindrome(word1) && isPalindrome(word2)) {\n                int length1 = word1.size();\n                int length2 = word2.size();\n                maxProduct = Math.max(maxProduct, length1 * length2);\n            }\n            return;\n        }\n        // otherwise consider other cases\n        word1.add(s.charAt(currentIndex));\n        recursionHelper(s, currentIndex + 1, word1, word2);\n        // undo\n        word1.remove(word1.size() - 1);\n        // try the other possiblity with word2\n        word2.add(s.charAt(currentIndex));\n        recursionHelper(s, currentIndex + 1, word1, word2);\n        // undo\n        word2.remove(word2.size() - 1);\n        // try possiblity without adding the char at index to both word1 and word2\n        recursionHelper(s, currentIndex + 1, word1, word2);\n    }\n    \n    public boolean isPalindrome(List<Character> word) {\n        int size = word.size();\n        int left = 0;\n        int right = size - 1;\n        while (left < right) {\n            if (word.get(left++) != word.get(right--)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n```
['Recursion', 'Java']