From bac304aab2928a1b8c7f68ae1afd39382c6a36ba Mon Sep 17 00:00:00 2001 From: Victor Alexandrovich Tsyrenschikov <77172321+tsyrenschikov@users.noreply.github.com> Date: Wed, 12 Nov 2025 13:44:39 +0500 Subject: [PATCH] Project --- 24.5.py | 8 +++----- 24.6.py | 2 +- f.py | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/24.5.py b/24.5.py index b7bbe86..d1949d9 100644 --- a/24.5.py +++ b/24.5.py @@ -1,14 +1,12 @@ import re -str1=open('24_5.txt').read().strip('\n') -# result=re.split(r'(?<=PP)',str1) #Позитивная ретроспективная проверка (Positive Lookbehind) +str1=open('24_5.txt').read() +# result=re.split(r'(?=PP)',str1) #Позитивная ретроспективная проверка (Positive Lookbehind) result=re.split(r'(?=PP)',str1) #позитивная опережающая проверка (positive lookahead) # result=re.split(r'P(?=P)',str1) print(max(list(map(len,result)))) - - # f=open('24_5.txt') -# s=f.read().rstrip() +# s=f.read() # k=1 # kmax=0 # diff --git a/24.6.py b/24.6.py index 969e82a..bb45282 100644 --- a/24.6.py +++ b/24.6.py @@ -1,5 +1,5 @@ import re str1=open('24_6.txt').read().strip() -result=re.split(r'000+',str1) +result=re.split(r'(?=00)0',str1) #Негативный просмотр вперед (Negative Lookahead) print(max(list(map(len,result)))) \ No newline at end of file diff --git a/f.py b/f.py index 30f0496..f66da19 100644 --- a/f.py +++ b/f.py @@ -1,5 +1,5 @@ import re str1=open('24_1.txt').read() -result=re.findall(r'B*',str1) -print(max(list(map(len,result)))) \ No newline at end of file +result=re.findall(r'B+',str1) +print(max(map(len,result))) \ No newline at end of file