PwC Interview Question

Write code to balance paranthese.