Group no.
22
84 Pingle Sanskruti Somnath
85 Wagh Vrushali Anil
86 Deshpande Shreya
87 Chandrashekhar Dhanapune Aatmaja Dilip
Implementation of Palindrome checker [stack and queues]
from collections import deque
def is_palindrome(string):
# Initialize stack and queue
stack = []
queue = deque()
# Convert to lowercase and ignore non-alphanumeric characters
for ch in string:
if [Link]():
ch = [Link]()
[Link](ch)
[Link](ch)
# Compare elements from stack and queue
while stack and queue:
if [Link]() != [Link]():
return False
return True
string = input("Enter a string: ")
if is_palindrome(string):
print("The given string is a Palindrome.")
else:
print("The given string is NOT a Palindrome.")
OUTPUT: