Leetcode 551 Student Attendance Record I
#include <string>
using namespace std;
class Solution {
public:
bool checkRecord(string s) {
//两个以上连续的L也就是存在LLL
int aFreq = 0;
int length = s.length();
int i = 0;
while (i < length){
if (s[i] == 'A')
aFreq++;
i++;
}
if (aFreq > 1 || s.find("LLL")!=string::npos)
return false;
else
return true;
}
};