import re


def gloss(s: str, gloss_file: str) -> str:
    """Restores characters in s from gloss_file."""
    gloss_list = list(gloss_file)
    g = gloss_list.pop(0)

    def degloss_repl(matchobj):
        return gloss_list.pop(0)

    o = re.sub(g, repl=degloss_repl, string=s)
    return o