Question d’entretien chez EPAM Systems

How to validate string with brackets so they are valid