Student Attendance Record I

Easy

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.

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:

This input has 2 A's which meets the limit, but it is still false because strictly less than 2 A's (meaning at most 1 A) is required to be eligible for the award.

Constraints

  • 1 ≤ s.length ≤ 1000

Ready to solve this problem?

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