Pregunta de entrevista de EPAM Systems

How to validate string with brackets so they are valid