This commit is contained in:
Victor Alexandrovich Tsyrenschikov
2025-11-12 13:44:39 +05:00
parent a0347aff39
commit bac304aab2
3 changed files with 6 additions and 8 deletions

View File

@@ -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
#

View File

@@ -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))))

4
f.py
View File

@@ -1,5 +1,5 @@
import re
str1=open('24_1.txt').read()
result=re.findall(r'B*',str1)
print(max(list(map(len,result))))
result=re.findall(r'B+',str1)
print(max(map(len,result)))