What did you learn? Stacks naturally handle nested structures. Each open waits on the stack until its matching close arrives.
The "most recent" property is what makes stacks work for matching. Any close bracket must match the most recent open.
Edge cases matter: empty stack when you need to pop, non-empty stack at the end. This problem is simple, but the pattern generalizes to expression parsing, HTML tag matching, and more.