@@ -0,0 +1,1026 @@
+// https://codeforces.com/problemset/problem/202/A%0A%0Aimport java.util.Scanner;%0Aimport java.util.SortedSet;%0Aimport java.util.TreeSet;%0A%0Apublic class Solution %7B%0A%0A%09static SortedSet%3CString%3E palindromeSubsequences = new TreeSet%3C%3E();%0A%09%0A%09public static boolean isPalindrome(String str) %7B%0A%09%09return new StringBuilder(str).reverse().toString().equals(str);%0A%09%7D%0A%09%0A%09// https://www.geeksforgeeks.org/print-all-subsequences-of-a-string-using-arraylist%0A%09public static void addAllPalindromeSubsequences(String sub, String ans) %7B%0A%09%09if (sub.length() == 0) %7B%0A%09%09%09if (isPalindrome(ans)) %7B%0A%09%09%09%09palindromeSubsequences.add(ans);%0A%09%09%09%7D%0A%09%09%09return;%0A%09%09%7D%0A%09%09char ch = sub.charAt(0);%0A%09%09String ros = sub.substring(1);%0A%09%09addAllPalindromeSubsequences(ros, ans);%0A%09%09addAllPalindromeSubsequences(ros, ans+ch);%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Scanner read = new Scanner(System.in);%0A%0A%09%09String s = read.nextLine();%0A%0A%09%09addAllPalindromeSubsequences(s, %22%22);%0A%09%09%0A%09%09System.out.println( palindromeSubsequences.last() );%0A%0A%09%09// Close scanner%0A%09%09read.close();%0A%09%7D%0A%0A%7D%0A

Create LLPS.java