Problems: A palindrome is a sequence of characters whose reversal gives the same sequence. Examples are “radar” and “noon”. Using a stack and a queue, write an algorithm that reads a string, and determines if the string contains a palindrome/s. Display the palindrome/s found. Implement your algorithm in Java or C++. Note: ➢ convert your string to lowercase ➢ do not use strings or arrays except when implementing the stack and the queue and for storage of your input string ➢ do not use any built-in method to determine if a word is a palindrome Sample runs: 1. Input : madam Output : palindrome/s in the string : madam 2. input : I love madam ABBA Output : palindrome/s in the string : madam abba 3. input : the quick brown fox Output : palindrome/s in the string : no palindrome
Problems:
A palindrome is a sequence of characters whose reversal gives the same sequence.
Examples are “radar” and “noon”. Using a stack and a queue, write an
reads a string, and determines if the string contains a palindrome/s. Display the
palindrome/s found. Implement your algorithm in Java or C++.
Note:
➢ convert your string to lowercase
➢ do not use strings or arrays except when implementing the stack and the queue
and for storage of your input string
➢ do not use any built-in method to determine if a word is a palindrome
Sample runs:
1. Input : madam
Output : palindrome/s in the string : madam
2. input : I love madam ABBA
Output : palindrome/s in the string : madam abba
3. input : the quick brown fox
Output : palindrome/s in the string : no palindrome
Step by step
Solved in 2 steps