Longest Valid Parentheses: use a stack