# Student Attendance Record I

You are given a string representing an attendance record for a student. The record only contains the following three characters:

1. **'A'**: Absent.
2. **'L'**: Late.
3. **'P'**: Present.

A student could be rewarded if his attendance record doesn't contain **more than one 'A' (absent)** or **more than two continuous 'L' (late)**.

You need to return whether the student could be rewarded according to his attendance record.

**Example 1:**

```
Input:"PPALLP"

Output:True
```

**Example 2:**

```
Input:"PPALLL"

Output:False
```

## 题目大意：

给定一个字符串s，若其中的'A'大于1个，或者出现连续的3个或3个以上'L'，返回False，否则返回True

## 解题思路：

字符串处理

```
class Solution(object):
    def checkRecord(self, s):
        """
        :type s: str
        :rtype: bool
        """
        return s.count('A') <=1 and 'LLL' not in s
```

```
class Solution(object):
    def checkRecord(self, s):
        """
        :type s: str
        :rtype: bool
        """
        #return s.count('A') <=1 and 'LLL' not in s
        count = 0
        maxcont = 0
        for i in s:
            if i == 'L':
                count += 1
                maxcont = max(maxcont, count)
            else:
                count = 0
        if maxcont <= 2 and s.count('A') <= 1:
            return True
        return False
```
