Validate nested HTML-style tags
A tiny templating engine hands you a stream of tags already tokenized for you: an opener is a name like "div", a closer is the same name prefixed with /, like "/div". A document is well formed when every closer matches the most recently opened, still-open tag, and nothing is left open at the end.
["div", "span", "/span", "/div"] -> True
["div", "/span"] -> False # closes the wrong tag
["p", "b", "/p", "/b"] -> False # crossed nesting
["a"] -> False # never closed
Return whether the tag stream is well formed. Aim for .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.