mirror of
https://github.com/Alexander-D-Karpov/scripts.git
synced 2024-11-22 11:56:33 +03:00
24 lines
505 B
Python
24 lines
505 B
Python
|
with open("24.txt") as f:
|
||
|
data = f.read()
|
||
|
|
||
|
|
||
|
data = data.split("F")
|
||
|
|
||
|
mx = 0
|
||
|
mf = ""
|
||
|
for i in range(len(data)):
|
||
|
if data[i] and data[i].count("A") <= 2:
|
||
|
p = []
|
||
|
j = i + 1
|
||
|
try:
|
||
|
while data[j].count("A") <= 2:
|
||
|
p.append(data[j])
|
||
|
j += 1
|
||
|
s = "F" + "F".join(p) + "F"
|
||
|
if len(s) > mx:
|
||
|
mx = len(s)
|
||
|
mf = s
|
||
|
except IndexError:
|
||
|
break
|
||
|
print(mx, mf)
|