Solution to Valid Parantheses