Question: Using this code I have to: Modify your Palindrome program to process phrases. E.g. My gym Was it a cat I saw? Eva, can I
Using this code I have to:
Modify your Palindrome program to process phrases. E.g.
- My gym
- Was it a cat I saw?
- Eva, can I see bees in a cave?
- No lemon, no melon

1 import java.util.Scanner; 2 5 6 7 3 public class Palindrome 4 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { 10 System.out.println(" Enter a word OR -1 to stop"); // ask user to enter input 11 String word = sc.nextLine(); // stores the input in word. word = word.trim(); // removes any spaces from beginning or end of a word. 8 9 12 13 14 15 16 17 18 if(!"-1".equals(word)) // checks if word is not equal to -1 then this if block will ex { int start=0 end = word. length() - 1, flag = 0; while (start
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
