This doesn't really matter, but FYI you can write `"".join(priority[k] for k in matches)` without the list brackets and python will use a generator instead. :)