import re


def word_count(text: str) -> int:
    """
    Counts the total words in a string.

    Parameters
    ------------
    text: str
        The text to count the words of.

    Returns
    ------------
    int
        The number of words in the text.
    """
    list_words = re.split(' |\n|\t', text) #Splits along spaces
    list_words = list(filter(str.strip, list_words))
    return len(list_words)