public class Sentence { private String text; public Sentence (String aText) { text = aText; } public boolean isPalindrome (int start, int end) { char first, last; if (start >= end) return true; first = Character.toLowerCase(text.charAt(start)); last = Character.toLowerCase (text.charAt(end)); if (Character.isLetter(first) && Character.isLetter(last)) { if (first == last) { return isPalindrome(start + 1, end -1); } else return false; } else if (!Character.isLetter(last)) { return isPalindrome (start, end-1); } else { return isPalindrome (start+1, end); } } // end 2 argument isPalindrome public boolean isPalindrome() { return isPalindrome (0, text.length() - 1); } } // end class