def get_shared_prefix(word1: str, word2: str) -> str:
    """
    Get the substring in the beginning of word1 and word2 which both share.

    Parameters
    ----------
    word1 : str
    word2 : str

    Returns
    -------
    shared_prefix : str

    Examples
    --------
    >>> get_shared_prefix("foo", "bar")
    ''
    >>> get_shared_prefix("foobar", "bar")
    ''
    >>> get_shared_prefix("foobar", "foo")
    'foo'
    >>> get_shared_prefix("steamship", "steampowered")
    'steam'
    """
    shared_prefix = ""
    for char1, char2 in zip(word1, word2):
        if char1 == char2:
            shared_prefix += char1
        else:
            break
    return shared_prefix