// Given a stack, the task is to sort it such that the top of the stack has the greatest element.