def suffix_func(x: str, pattern: str) -> int:
    """
    The suffix (\sigma) function that asserts the length of the prefix
    of the `pattern` that is a suffix of the provided string (`x`).
    """
    output = 0
    for k in range(1, len(pattern)+1):
        if x.endswith(pattern[0:k]):
            # it has that suffix
            output = k
    return output