Design and implement a system that validates nested brackets or structures using a stack-based approach.