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):