Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Reverse a word using stack or queues
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.