import re


def strtr(s: str, repl: dict) -> str:
    """Replace substrings in 's' matching 'repl' keys with corresponging values
    """
    pattern = '|'.join(map(re.escape, sorted(repl, key=len, reverse=True)))
    if repl:
        return re.sub(pattern, lambda m: repl[m.group()], s)
    else:
        return s