A palindromic sentence is a sentence that is spelt the same forwards as backwards, ignoring punctuation and case. For example, 'Madam, I'm Adam' is a palindromic sentence, as is 'Never odd or even'. 'Hello world' is not a palindromic sentence.
Extend your Palindromes class above to include the following method, which tests whether a given sentence is palindromic:
public static boolean isPalindromeSentence(String sentence) throws EmptyStackException, EmptyQueueException;
The methods Character.isAlphabetic() and Character.toLowerCase() could be useful here.
Comments
Leave a comment