scripts/ege/25013092/24.py

15 lines
300 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
with open("24.txt") as f:
data = f.read()
mx = 0
for i in range(len(data)):
for j in range(i + 1, len(data)):
s = data[i:j]
if s.count("D") <= 2:
if len(s) > mx:
mx = len(s)
print(mx)
else:
break