You are given a string `s` that records a student's attendance, one character per day: `'A'` absent, `'L'` late, `'P'` present. The student earns an attendance award if they were absent strictly fewer than 2 days in total and were never late on 3 or more consecutive days. Return `true` if the student is eligible, otherwise `false`.
You are given a string s that records a student's attendance, one character per day: 'A' absent, 'L' late, 'P' present. The student earns an attendance award if they were absent strictly fewer than 2 days in total and were never late on 3 or more consecutive days. Return true if the student is eligible, otherwise false.
Example 1:
Input: {"s":"PPALLP"}
Output: true
Constraints:
1≤s.length≤1000
s[i] is 'A', 'L' or 'P'.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"PPALLP"}
attendance: P present, A absent, L late
P
1
P
2
A
3
L
4
L
5
P
6
Walk the record day by day with two counters: total absences (must stay below 2) and the current run of late days (must stay below 3).