Example 1: text-file reversal
A text file is a sequence of (zero or more) lines.
To reverse the order of these lines, we must store them in a first-in-last-out sequence.
Text-file reversal algorithm:
To output the lines of file in reverse order:
1. Make line-stack empty.2. For each line read from file, repeat: 2.1. Add line to the top of line-stack.3. While line-stack is not empty, repeat: 3.1. Remove a line from the top of line-stack into line. 3.2. Output line.4. Terminate.