My task is to define a procedure is_palindrome, that takes as input a string, and returns a boolean indicating if the input string is a palindrome. In this case a single let
Respuesta en Java
public class Varios {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println( pali("anitalavalatina"));
}
static boolean pali(String palabra){
System.out.println(palabra);
if (palabra.length()-1<2)
return true;
if(palabra.charAt(0)!=palabra.charAt(palabra.length()-1)) return false;
return pali(palabra.substring(1,palabra.length()-1));
}
}