Braze interview question

Find number of valid nested parentheses in a string