<jupyter_start><jupyter_text>LeetCode 551. Student Attendance Record I Question    https://leetcode.com/problems/student-attendance-record-i/    You are given a string representing an attendance record for a student. The record only contains the following three characters:    'A' : Absent.    'L' : Late.    'P' : Present.    A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late).    You need to return whether the student could be rewarded according to his attendance record.Example 1:        Input: "PPALLP"    Output: TrueExample 2:    Input: "PPALLL"    Output: False  My Solution<jupyter_code>def checkRecord(s):
    if 'LLL' in s:
        return False

    a = 0
    for ss in s:
        if ss == 'A':
            a += 1
            if a == 2:
                return False
    return True    
# test code
s = "PPALLP"
checkRecord(s)<jupyter_output><empty_output><jupyter_text>My Result__Runtime__ : 28 ms, faster than 84.71% of Python3 online submissions for Student Attendance Record I.__Memory Usage__ : 12.7 MB, less than 100.00% of Python3 online submissions for Student Attendance Record I.  @deerishi's Solution<jupyter_code>def checkRecord(s):
    return len(s.split('A'))<=2 and s.find('LLL')==-1
# test code
s = "PPALLP"
checkRecord(s)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09324522760646109, 'fraction_numerical': 0.01908957415565345, 'mean_word_length': 3.3546325878594248, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '389981', 'license': 'MIT', 'n_tokens_mistral': 438, 'n_tokens_neox': 413, 'n_words': 156, 'path': 'LeetCode/LeetCode_551StudentAttendanceRecordI.ipynb', 'repo_name': 'foxsayy/python', 'size': '1362'}