every blog every motto: You will never know unless you try
0. 前言
生活好难,再坚持坚持!
1. 字符串
1.1 题目
1.2
class Solution:
def checkRecord(self, s: str) -> bool:
count = {
'A':0,'L':0,'P':0}
p_flag = 0
index = 0
for ele in s:
count[ele] +=1
if count['A']>=2:
return False
if s[index] == 'L' and index < len(s) - 2:
if s[index+1] == 'L' and s[index+2] == 'L':
return False
index += 1
return True