class Solution:
"""
@param s: a string
@return: whether the student could be rewarded according to his attendance record
"""
'''
大致思路:
1.循环s,初始化count_A,如果count_A的次数大于1的话,或者是超过连续出现两个l的话,则直接返回False,否则True.
'''
def checkRecord(self,s):
count_A = 0
s = s + ''for i in range(len(s)):
if s[i] == 'A':
count_A += 1if count_A > 1 or (s[i] == 'L' and s[i+1] == 'L' and s[i+2] == 'L'):
return False
return True