Given a string of brackets representing nested UI configurations, determine if the input string is valid.