djfz-2023-s464986/TaskG04/run.py

18 lines
369 B
Python

import sys
def binary_to_utf8(binary_input):
decimal_value = int(binary_input, 2)
utf8_text = decimal_value.to_bytes((decimal_value.bit_length() + 7) // 8, 'big').decode('utf-8')
return utf8_text
for line in sys.stdin:
if not line.strip():
print(line, end='')
continue
utf8_text = binary_to_utf8(line)
print(utf8_text)