Check whether string has balanced paranthesis