from typing import Union
from typing import List


def remove_prefix_suffix(
    x: str, prefix: Union[str, List[str]], suffix: Union[str, List[str]]
) -> str:
    """
    Remove the prefix and suffix from a string,
    prefix and suffix can be a string or a list of strings.
    :param x: input string
    :param prefix: a string or a list of strings, will check prefix one by one
    :param suffix: a string or a list of strings, will check suffix one by one
    :return: the string without prefix/suffix
    """
    if isinstance(prefix, str):
        prefix = [prefix]
    if isinstance(suffix, str):
        suffix = [suffix]

    for s in prefix:
        if x.startswith(s):
            x = x[len(s) :]
            break

    for s in suffix:
        if x.endswith(s):
            x = x[: -len(s)]
            break

    return x