import re


def replace_simultaneous(s: str, r0: str, r1: str) -> str:
    """
    Replace all instances of `r0` in `s` with `r1` and vice versa.

    This method does the replacements simultaneously so that, e.g.,
    if you call `replace_simultaneous("apple banana", "apple", "banana")`
    the result will be `"banana apple"` instead of either `"apple apple"`
    or `"banana banana"` for a sequential replacement (depending on the
    order of the replacements).
    It is assumed that `r0` is not a substring of `r1` and vice versa.

    :param s: string to do replacements in
    :param r0: first string to replace
    :param r1: second string to replace
    """
    replacement = {r0: r1, r1: r0}
    r0 = re.escape(r0)
    r1 = re.escape(r1)
    return re.sub(f"{r0}|{r1}", lambda x: replacement[x.group()], s)