scripts/ege/Вариант 14/Задание 24/24.py
2023-05-05 00:45:01 +03:00

31 lines
697 B
Python

with open("24.txt") as f:
data = f.read()
mx = 0
data = data.split("%")
for seq in data:
c = 0
f = False
if seq:
for i in range(0, len(seq), 3):
d = seq[i : i + 3]
if d in ["?!?", "?!", "!"] and f:
if f:
c += len(d)
else:
c = len(d)
f = True
elif d == "?!?":
f = True
c = 3
else:
if f:
f = False
if c > mx:
mx = c
print(seq, c)
c = 0
print(mx)