fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner s=new Scanner(System.in);
  13. int N=s.nextInt();
  14. String str=String.valueOf(N);
  15. boolean ans=solve(str,0,str.length()-1);
  16. System.out.println(ans);
  17.  
  18. }
  19. public static boolean solve(String str,int start,int end){
  20.  
  21. if(start>=end){
  22. return true;
  23. }
  24.  
  25. return (str.charAt(start)==str.charAt(end)&&solve(str,start+1,end-1));
  26.  
  27. }
  28. }
Success #stdin #stdout 0.12s 54608KB
stdin
-232
stdout
false