input: from typing import List
  
  def has_matching_parentheses(s: str) -> bool:
      """ Check if the given string has matching parentheses.
      >>> has_matching_parentheses("(()()())")
      True
      >>> has_matching_parentheses("((())")
      False
      >>> has_matching_parentheses(")(")
      False
      >>> has_matching_parentheses("()")
      True
      """
output:     stack = []
      for char in s:
          if char == '(':
              stack.append(char)
          elif char == ')':
              if not stack or stack.pop() != '(':
                  return False
      return len(stack) == 0