From 31f50d9a08f850d50d8a8dfcc661768764e01947 Mon Sep 17 00:00:00 2001 From: Victor Alexandrovich Tsyrenschikov <77172321+tsyrenschikov@users.noreply.github.com> Date: Fri, 21 Nov 2025 00:49:49 +0500 Subject: [PATCH] 24.7 --- 24.7.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/24.7.py b/24.7.py index 77c56a5..9f49bb1 100644 --- a/24.7.py +++ b/24.7.py @@ -15,4 +15,16 @@ # matches = re.findall(pattern, data) # # res = max([len(match[0] + match[1]) -# for match in matches]) \ No newline at end of file +# 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