Solve Exercise 4-4: Basic stack manipulation