def decode_line(line: str) -> str: """ Expected format: "<ciphertext> <decimal_key>" The ciphertext may contain any printable characters. """ m = re.fullmatch(r'\s*(\S+)\s+(\d+)\s*', line) if not m: raise ValueError("Invalid input format") cipher, key_str = m.groups() key = int(key_str)