Java Bitmask + HashMap solution
\nclass Solution {\n\n    //using bitmask\n   public int maxProduct(String s) {\n      \n      if(s.length() == 2) {\n         return 1;\n      }\n      \n     
```\nclass Solution {\n\n    //using bitmask\n   public int maxProduct(String s) {\n      \n      if(s.length() == 2) {\n         return 1;\n      }\n      \n      int n = s.length();\n      char[] ch = s.toCharArray();\n   \n      //bitmask to the length map\n      Map<Integer, Integer> bitMasktoLengthMap = new HashMap<>();\n      \n      //using bitmask , calculate all the bitmask for 1 to 2^N\n      // 1, 2, 3,............2024 ( 2 ^ 11 )\n      for(int bitmask = 1 ; bitmask< Math.pow(2, n) ;bitmask++){\n          \n          //find all the subsequence(s) in the string using bitmask\n          StringBuilder subsequence = new StringBuilder();\n          for(int j = 0; j < n; j++ ){\n   \n             //if one of the bit is set to 1, then append that character to the subsequence.\n             if(( bitmask & (1 << j ) ) != 0) { \n                subsequence.append(ch[j]);  //constructing subsequence of different length\n             }\n          }\n          \n          //if the sequence constructed above is a palindrome,\n         // then store the mask and its length .\n          if(isPalindrome(subsequence.toString().toCharArray())){\n             bitMasktoLengthMap.put(bitmask, subsequence.length());\n          }\n      }\n      \n      Set<Integer> allBitMasks = bitMasktoLengthMap.keySet();\n      \n      int maxProduct = Integer.MIN_VALUE;\n      for( int mask1 : allBitMasks){\n         \n         for( int mask2 : allBitMasks){\n   \n            //product of lengths of 2 disjoint palindromic subsequence(s)\n            //if product of AND operation is 0 then subsequnce(s) are DIS-JOINT\n             if(( mask1 & mask2 ) == 0){\n                int product = bitMasktoLengthMap.get(mask1) * bitMasktoLengthMap.get(mask2);\n                maxProduct = Math.max(maxProduct, product);\n             }\n         }\n      }\n      \n      \n      return maxProduct;\n   }\n   \n   private boolean isPalindrome( char[] chars ) {\n      \n      int i = 0;\n      int j = chars.length - 1;\n      \n      if(i == j)\n         return true;\n      \n      while(i < j){\n         if(chars[i] != chars[j]){\n            return false;\n         }\n         i++;\n         j--;\n      }\n      \n      return true;\n   }\n}\n```\n\nSteps :\n\n1. In order to find all the subsequence , we will use the bitmask from 1 to 2^ N .\n2. We will do AND operation to find the bit which is set ( bitmask & (1 << j ) ) != 0)  then it means bit is SET.\n3. We will construct all the subsequence in this way for a sting of lengt N.\n4. Then we will check if the string is palindrome ( same from backward and forward ).\n5. If string is palindrome, then add the "bitmask" and its length to the map.\n6. At end , we need to check ( key1 & key2 ) gives a zero , which means palindromic subsequence is disjoint i.e. they have no bit in common to each other.  \n7. If ( key1 & key2 ) == 0 , then we calculate product of their length ( value1 * value 2 ).\n8. We find the maximum value from  multiple set(s) of ( value1 * value 2 ).\n
['Bit Manipulation', 'Bitmask', 'Java']