In Figure 7.3, we presented a program that checks a string to see if the letters in

Question:

In Figure 7.3, we presented a program that checks a string to see if the letters in the string read the same forward and backward. These strings are called palindromes. Another kind of palindrome is one in which we look at words rather than letters. A word-by-word palindrome is a string of words such that the words read the same forward and backward. For example, the quote “You can cage a swallow, can’t you, but you can’t swallow a cage, can you?” is a word-byword palindrome. Write a program to test an input string and tell whether or not it is a word-by-word palindrome. Consider upper- and lowercase letters to be the same letter. Define a word as any string consisting of only letters or an apostrophe and bounded at each end with one of the following: a space, a punctuation mark, the beginning of the line, or the end of the line. Your program should have a friendly interface and allow the user to check more lines until the user wishes to quit the program.

public static boolean is_palindrome (String input) // The return value is true if and only if the input string is a palindrome. // All non-letters are ignored, and the case of the letters is also ignored. // See page 365 for an explanation of using Java's LinkedList class as a

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: