1
class Solution {
2
public:
3
bool checkRecord(string s);
4
};
5
/*********************************************************/
6
bool Solution::checkRecord(string s) {
7
int i, size = s.size(), maxL = 0, countA = 0, countL = 0;
8
for (i = 0; i < size; ++i) {
9
if (s[i] == 'L') {
10
++countL;
11
} else {
12
countL = 0;
13
}
14
if (s[i] == 'A') {
15
++countA;
16
}
17
if (maxL < countL) {
18
maxL = countL;
19
}
20
if (countA >= 2 || maxL >= 3) {
21
return false;
22
}
23
}
24
return true;
25
}
26
/*********************************************************/

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0