import itertools


def unique_prefix_of(a: str, b: str) -> str:
    """
    Return the unique prefix of `a` with `b`.

    Corner cases:

    * If `a` and `b` share no prefix, the first letter of `a` is returned.
    * If `a` and `b` are equal, `a` is returned.
    * If `a` is a prefix of `b`, `a` is returned.
    * If `b` is a prefix of `a`, `b` plus the first letter of `a` after the
      common prefix is returned.
    """
    for i, (ca, cb) in enumerate(itertools.zip_longest(a, b)):
        if ca != cb:
            return a[:i+1]
    # both are equal, return a
    return a