willieshi232

Untitled

Apr 19th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import java.util.*;
  2. public class bob
  3. {
  4. public static void main(String [] args)
  5. {
  6. Scanner console = new Scanner(System.in);
  7. String input = console.next();
  8. boolean x = isPalindrome(input);
  9. System.out.print(x);
  10. }
  11. public static boolean isPalindrome(String x)
  12. {
  13. if(x.length() > 1)
  14. {
  15. if(x.charAt(0) == x.charAt(x.length()-1))
  16. {
  17. isPalindrome(x.substring(1, x.length() - 2));
  18. return true;
  19. }
  20. else
  21. {
  22. return false;
  23. }
  24. }
  25. return true;
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment