JWP (JW Player) interview question

How you write a program to balance parentheses?