Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class bob
- {
- public static void main(String [] args)
- {
- Scanner console = new Scanner(System.in);
- String input = console.next();
- boolean x = isPalindrome(input);
- System.out.print(x);
- }
- public static boolean isPalindrome(String x)
- {
- if(x.length() > 1)
- {
- if(x.charAt(0) == x.charAt(x.length()-1))
- {
- isPalindrome(x.substring(1, x.length() - 2));
- return true;
- }
- else
- {
- return false;
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment