input: Write a function to find the maximum number of valid nested parentheses in a string.
  assert max_valid_parenthesis("((()))") == 3
  assert max_valid_parenthesis("()()") == 1
  assert max_valid_parenthesis("((()())(()))") == 3
  assert max_valid_parenthesis(")(") == 0
output: def max_valid_parenthesis(s):
      max_depth = 0
      current_depth = 0
      
      for char in s:
          if char == '(':
              current_depth += 1
              max_depth = max(max_depth, current_depth)
          elif char == ')':
              if current_depth > 0:
                  current_depth -= 1
      
      return max_depth