21 lines
369 B
Python
21 lines
369 B
Python
import re
|
|
|
|
str1=open('24_5.txt').read().strip('\n')
|
|
result=re.split(r'(?<=PP)',str1)
|
|
# result=re.split(r'P(?=P)',str1)
|
|
print(max(list(map(len,result))))
|
|
|
|
|
|
# f=open('24_5.txt')
|
|
# s=f.read().rstrip()
|
|
# k=1
|
|
# kmax=0
|
|
#
|
|
# for i in range(0, len(s)-1):
|
|
# if s[i]=='P' and s[i+1]=='P':
|
|
# k=1
|
|
# else:
|
|
# k=k+1
|
|
# kmax = max(k, kmax)
|
|
#
|
|
# print(kmax) |