/*
* @lc app=leetcode.cn id=551 lang=typescript
*
* [551] 学生出勤记录 I
*/
// @lc code=start
function checkRecord(s: string): boolean {}
// @lc code=end
function checkRecord(s: string): boolean {
let l = 0,
a = 0
for (const c of s) {
if (c === 'L') l++
else l = 0
if (c === 'A') a++
if (l === 3) return false
}
return a < 2
}
test.each([
{ input: { s: 'PPALLP' }, output: true },
{ input: { s: 'PPALLL' }, output: false },
{ input: { s: 'AAAA' }, output: false },
])('input: s = $input.s', ({ input: { s }, output }) => {
expect(checkRecord(s)).toEqual(output)
})