class Solution: def __init__(self): # empty instance variables self.queue = [] #FIFO self.stack = [] #LIFO def pushCharacter(self, char): new_char = self.stack.append(char) # adds character to stack return new_char def enqueueCharacter(self, char): new_char = self.queue.append(char) # adds character to queue return new_char def popCharacter(self): last_char = self.stack.pop(-1) # removes and returns last item in stack return last_char def dequeueCharacter(self): first_char = self.queue.pop(0) # removes and returns first item in stack return first_char # read the string s s=input() #Create the Solution class object obj=Solution() l=len(s) # push/enqueue all the characters of string s to stack for i in range(l): obj.pushCharacter(s[i]) obj.enqueueCharacter(s[i]) isPalindrome=True ''' pop the top character from stack dequeue the first character from queue compare both the characters ''' for i in range(l // 2): if obj.popCharacter()!=obj.dequeueCharacter(): isPalindrome=False break #finally print whether string s is palindrome or not. if isPalindrome: print("The word, "+s+", is a palindrome.") else: print("The word, "+s+", is not a palindrome.")