public class UsingSubString {
public static boolean isPalindrome(String s){
if(s.length()<=1){
return true;
}else if(s.charAt(0)!=s.charAt(s.length()-1)){
return false;
}else{
return isPalindrome(s.substring(1, s.length()-1));
}
}
public static void main(String[] args) {
String s = "advvef";
String s1 = s.substring(1, s.length()-1);
System.out.println(s1);
String s2 = s1.substring(1, s1.length()-1);
System.out.println(s2);
}
}
public static boolean isPalindrome(String s){
if(s.length()<=1){
return true;
}else if(s.charAt(0)!=s.charAt(s.length()-1)){
return false;
}else{
return isPalindrome(s.substring(1, s.length()-1));
}
}
public static void main(String[] args) {
String s = "advvef";
String s1 = s.substring(1, s.length()-1);
System.out.println(s1);
String s2 = s1.substring(1, s1.length()-1);
System.out.println(s2);
}
}