Question: this program is about identifying palindromes. A palindrome is a string that reads the same forward as backward. Some examples of palindromes are: Able was

 this program is about identifying palindromes. A palindrome is a string
that reads the same forward as backward. Some examples of palindromes are:

this program is about identifying palindromes. A palindrome is a string that reads the same forward as backward. Some examples of palindromes are: "Able was I ere, I saw Elba." "Madam, I'm Adam." An algorithm to determine a string is a palindrome or not, is given below: Algorithm: Input: A string L, a temporary empty stack S, a temporary empty queue Q Output: Returns if L is palindrome or not 1. Set: P- first character in L 2. while (P -n') do 3. Push P onto S 4. Enqueue P to Q 5. Set: P next character in L 6. end while 7. Set: palindrome true 8. while (palindrome AND !Q.ISEmpty) do 9. M Pop from S 10. N Dequeue from Q 11. if (MI- N) then 12. Set: palindrome false 13. end if 14. end while 15. if (palindrome) then 16. Write "String is a palindrome" 17. else 18. Write "String is not a palindrome" 19. end if Notice that both Stack and Queue have been used in the algorithm. Your task for this assignment is to implement the algorithm by considering two cases: (i) lowercase and uppercase are treated the same way and (ii) only alphanumeric characters are considered; all others are discarded Input/Output Take an input string from keyboard and print the result on the screen. Input/Output Take an input string from keyboard and print the result on the screen. Sample input/output: Enter a string: Able was I ere, I saw Elba. This string is a palindrome Enter a string: My major is Biology This string is not a palindrome. Page 4 of 5 Enter a string: Eve This string is a palindrome. Upload in the URCourses The source code (Assignment2PartB.CPP)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!