https://leetcode.com/problems/student-attendance-record-i/#/description
题目思路:本题将输入一只含有P,A,L 三个字母的字符串,如果该字符串超过一个A则返回false,或者该字符串有超过两个L连续出现在一起,则返回false
public class Solution {
public boolean checkRecord(String s) {
int a = 0;
for(int i = 0, len = s.length(); i < len; i++) {
if(s.charAt(i) == 'A')
a ++;
}
if(a > 1 || s.contains("LLL"))
return false;
else
return true;
}
}