update longest valid parenthese problem

learned a very elegant method