<s>[INST] def count_vowels(word):
    """
    Counts the number of vowels in a given string.

    Args:
    word (str): The input string.

    Returns:
    int: The number of vowels in the string.

    Raises:
    TypeError: If the input is not a string.

    """
    if not isinstance(word, str):
        raise TypeError("Input must be a string.")
    vowels = "aeiou"
    return sum(1 for char in word.lower() if char in vowels)

def count_vowels_regex(word):
    """
    Counts the number of vowels in a given string using regular expressions.

    Args:
    word (str): The input string.

    Returns:
    int: The number of vowels in the string.

    Raises:
    TypeError: If the input is not a string.

    """
    import re
    if not isinstance(word, str):
        raise TypeError("Input must be a string.")
    return len(re.findall(r'[aeiou]', word, flags=re.IGNORECASE))[/INST]