Student Attendance Record I

EasyString

Description

You are given a string s representing an attendance record. A student is eligible for an attendance award if they were absent fewer than 2 days total and never late 3 or more consecutive days. Return true or false.

Examples

Input:s = "PPALLP"
Output:true
Explanation:

Only 1 A, no 3 L's.

Input:s = "PPALLL"
Output:false
Explanation:

Contains 3 consecutive 'L's (late), which disqualifies the student from the attendance award.

Input:s = "ALLAPPP"
Output:false
Explanation:

Contains 2 A's, but the rule requires fewer than 2 (i.e., at most 1).

Constraints

  • 1 ≤ s.length ≤ 1000

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!