An application of stack