28 lines
687 B
Python
28 lines
687 B
Python
|
import base64
|
||
|
import sys
|
||
|
|
||
|
WIDTH = 80
|
||
|
PREFIX = 4
|
||
|
|
||
|
|
||
|
def split_encoded(bytes_str: str, width: int):
|
||
|
for i in range(0, len(bytes_str), width):
|
||
|
yield bytes_str[i : i + width]
|
||
|
|
||
|
|
||
|
sys.stdin.reconfigure(encoding="utf-8")
|
||
|
code = sys.stdin.read().strip()
|
||
|
code = str(base64.b85encode(code.encode("utf-8")))
|
||
|
code = code[:-1]
|
||
|
|
||
|
print(f"{' ' * PREFIX}code = (")
|
||
|
first = True
|
||
|
for line in split_encoded(code, WIDTH - PREFIX):
|
||
|
if first:
|
||
|
print(f"{' ' * (PREFIX + 4)} {line}'")
|
||
|
first = False
|
||
|
else:
|
||
|
print(f"{' ' * (PREFIX + 4) } + b'{line}'")
|
||
|
print(f"{' ' * PREFIX})")
|
||
|
print(f"{' ' * PREFIX}exec(__import__('base64').b85decode(code))")
|