This commit is contained in:
Victor Alexandrovich Tsyrenschikov
2025-11-21 01:18:03 +05:00
parent 31f50d9a08
commit ab351a7fa0

22
24.7.py
View File

@@ -18,13 +18,15 @@
# for match in matches]) # for match in matches])
s = open('24_7.txt').readline().strip() f = open('24_7.txt').read().strip()
pos = [-1] a = []
for p in range(len(s) - 1): for i in range(len(f) - 1):
if s[p]+s[p+1] == 'CD': if f[i]+f[i+1] == 'CD':
pos.append(p) a.append(i)
pos.append(len(s) - 1) print(max([p1-p for p,p1 in zip(a, a[161:])]))
ml = 0
for p, p1 in zip(pos, pos[161:]): # lst1 = [0, 1, 2, 3, 4, 5]
ml = max(ml, p1 - p) # lst2 = [5, 3, 2, 0, 4, 1]
print(ml) # lst3 = ['нуль', 'один', 'два', 'три', 'четыре', 'пять']
# for a, b, c in zip(lst1, lst2, lst3):
# print(f'{c} {a} {b}')