fork download
  1. public class Main {
  2. public static boolean isPalindrome(String s) {
  3. return s.length() < 2 || (s.charAt(0) == s.charAt(s.length() - 1)
  4. && isPalindrome(s.substring(1, s.length() - 1)));
  5. }
  6.  
  7. public static void main(String[] args) {
  8. System.out.println(isPalindrome("Kaak"));
  9. }
  10. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
false