solve the longest valid parentheses.