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