PwC interview question

Write code to balance paranthese.