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:
[b]for i:=length(word) downto 1 do
backwardword:=backwardword + word[i];[/b]
[b]if word = backwardword[/b] I also have a [color=Blue]palindrome[/color].
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.
0 · ·