Added the brackets validation in a given string