Hello all,
I need to do a program to reverse a word a user enters using stacks or queues. It has to be really really simple (no crazy procedures).
I know how to do it with strings:
for i:=length(word) downto 1 do
backwardword:=backwardword + word[i];
if word = backwardword I also have a
palindrome.
But I need to use ONLY stacks or queues (or both).
I know that a STACK would let me reverse its order easily by using POP but I can't understand how to do this using a word a user enters because I don't understand the syntax for stacks.
Besides this, as point 2: I need to check if the word is a palindrome.
Thanks in advance for your help.