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



'A' : Absent. 
'L' : Late.
 '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

Difficulty: EASY
Starter code: class Solution:
    def checkRecord(self, s: str) -> bool:
        

Solutions:
class Solution:

	def checkRecord(self, s):
		count = 0
		for i in range(0, len(s)):
			if s[i] == 'A':
				count += 1
				if count == 2:
					return False
			elif i >= 2 and s[i] == 'L' and (s[max(i - 1, 0)] == 'L') and (s[max(i - 2, 0)] == 'L'):
				return False
		return True


class Solution:

	def checkRecord(self, s):
		twoL = 0
		twoA = 0
		i = 0
		while i < len(s):
			if s[i] == 'A':
				twoA += 1
				if twoA > 1:
					return False
				twoL = 0
			elif s[i] == 'L':
				twoL += 1
				if twoL > 2:
					return False
			else:
				twoL = 0
			i += 1
		return True


class Solution:

	def checkRecord(self, s):
		if not s:
			return
		c = 0
		if s == 'AA':
			return False
		for i in range(len(s) - 2):
			if s[i] == 'L':
				if s[i] == s[i + 1] and s[i] == s[i + 2]:
					return False
			if s[i] == 'A':
				c += 1
				if c == 2:
					return False
		return True


class Solution:

	def checkRecord(self, s):
		return s.count('A') <= 1 and s.count('LLL') == 0


class Solution:

	def checkRecord(self, s):
		aCount = 0
		clCount = 0
		for r in s:
			if r == 'A':
				aCount += 1
				if aCount > 1:
					return False
			if r == 'L':
				clCount += 1
				if clCount > 2:
					return False
			else:
				clCount = 0
		return True


class Solution:

	def checkRecord(self, s):
		return s.count('A') < 2 and 'LLL' not in s


class Solution:

	def checkRecord(self, s):
		from collections import Counter
		val = Counter(s)
		idx = []
		for i in range(len(s)):
			if s[i] == 'L':
				idx.append(i)
		for j in range(len(idx) - 2):
			if idx[j + 2] - idx[j] == 2:
				return False
		if val['A'] > 1:
			return False
		return True


class Solution:

	def checkRecord(self, s):
		charA = charL = 0
		for c in s:
			if c == 'A':
				charA += 1
				if charA > 1:
					return False
				charL = 0
			elif c == 'L':
				charL += 1
				if charL > 2:
					return False
			else:
				charL = 0
		return True


class Solution:

	def checkRecord(self, s):
		mydir = {}
		for record in s:
			mydir[record] = mydir.get(record, 0) + 1
		return mydir.get('A', 0) <= 1 and s.count('LLL') == 0