36 lines
657 B
Python
36 lines
657 B
Python
import sys
|
|
sys.setrecursionlimit(1000000)
|
|
|
|
print("Expert zo zoo to vie.")
|
|
raw = sys.stdin.read()
|
|
rows = raw.split("\n")
|
|
if rows[-1] == "":
|
|
rows = rows[:-1]
|
|
|
|
pos = 0
|
|
question_count = 0
|
|
answer_count = 0
|
|
def bad_database():
|
|
print("Chybna databaza")
|
|
exit()
|
|
def load():
|
|
global pos, question_count, answer_count
|
|
|
|
if pos >= len(rows):
|
|
bad_database()
|
|
|
|
text = rows[pos]
|
|
pos += 1
|
|
|
|
if text == "":
|
|
bad_database()
|
|
|
|
if "?" == text[-1]:
|
|
question_count = question_count + 1
|
|
left = load()
|
|
right = load()
|
|
return (text, left, right)
|
|
else:
|
|
answer_count += 1
|
|
return (text,)
|