Our previous code golf ended with an overwhelming win, so now it's time for another one.
Parenthesis Hell is a Lisp-like esoteric programming language(esolang).
As a Lisp-like language, the code consists only of nested matched pairs of opened and closed parenthesis.
Your task is to write a method that receives a string of parenthesis and returns 1
if the order of the parenthesis is valid. For example, the string of parenthesis (())()
is valid because it contains a matched pair of opened and closed parenthesis at each position. The string ()((())))
is not valid because it contains one unmatched parenthesis.