Pregunta de entrevista de Bloomberg

Q: For the technical round, the question was how do you validate a string is valid/has parenthesis balanced? For example, "{}", "{}(){}[]", "[{(abcbc)}]", "abcd" are all balanced strings, whereas "{a", "{(})", "{a]", etc. are not.