Question: With using queues and stacks ( Chapter 4 and 5 ) , update the following program to show an input string is a palindrome string
With using queues and stacks Chapter and update the following program to show an input string is a palindrome string Chapter
A palindrome is a string that reads the same from both ends.
Lab Exam.pdf
Examples:
Input: str "geeksforgeeks"
Output: No
Input: str madam
Output: Yes
A sample instruction:
Enter a string str
Create a stack object and a queue object
In a loop, letter by letter of the string str push them in the stack and enqueue them in the queue :
Output: No
Input: str madam
Output: Yes
A sample instruction:
Enter a string str
Create a stack object and a queue object
In a loop, letter by letter of the string str push them in the stack and enqueue them in the queue :
Add in the main program the code of Push characters onto the stack and enqueue them in the queue
In another loop, compare the letters poping from the stack and dequeuing from the queue, if they are not the same, break or stop the loop and print that the entered string is not a palindrome. If all the letters poping from the stack and dequeuing from the queue are the same, your code should print the entered string is a palindrome.
Add in the main program the code of Pop from the stack and dequeue from the queue, comparing characters
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
