From 6a2446618a31f4ec7bc0f76e97d9508e7faf5936 Mon Sep 17 00:00:00 2001 From: MartinSkovran Date: Tue, 3 Nov 2026 14:13:27 +0100 Subject: [PATCH] oprava u8 --- u8/program.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/u8/program.py b/u8/program.py index a899368..1a50ec8 100644 --- a/u8/program.py +++ b/u8/program.py @@ -1,3 +1,6 @@ +import sys + + class Node: def __init__(self, text): self.text = text @@ -9,11 +12,17 @@ class Node: def read_line(): - try: - return input() - except EOFError: + line = sys.stdin.readline() + if line == "": return None + if line.endswith("\n"): + line = line[:-1] + if line.endswith("\r"): + line = line[:-1] + + return line + class Tree: def __init__(self):