Solution to balancing paraenthesis