Apply tag renames
Your task
A catalog cleanup ships with a rename table: a dictionary whose key is a deprecated tag and whose value is its replacement. Apply the table to a list of tags: each tag that appears as a key is replaced by its mapped value exactly once, the replacement is NOT looked up again, so chains like a to b and b to c must not turn "a" into "c". Tags absent from the table pass through unchanged, and the output keeps the input order and length. For example, tags ["lofi", "rock", "chill"] with renames {"lofi": "lo-fi", "chill": "calm"} give ["lo-fi", "rock", "calm"].
Examples
apply_renames(tags: list[str], renames: dict[str,str]) -> list[str]Example 1
Input
apply_renames(["lofi", "rock", "chill"], {"lofi": "lo-fi", "chill": "calm"})Output
["lo-fi", "rock", "calm"]