#C4884. Employee Scheduling Check
Employee Scheduling Check
Employee Scheduling Check
A company is evaluating a new scheduling system for its employees. Each day is represented by a 24-character string, where every character indicates the employee's status for that hour. The statuses are:
- A for available,
- U for unavailable, and
- M for meeting.
For each test case you are given an integer $k$ and the corresponding schedule string. Your task is to determine whether the schedule contains at least one contiguous segment of $k$ available hours (i.e. a substring of $k$ consecutive 'A's). Print YES
if it does, otherwise print NO
.
inputFormat
The input is read from standard input and has the following format:
The first line contains an integer T, representing the number of test cases.
For each test case, there are two lines:
- A line with an integer k, the required number of contiguous available hours ((k)).
- A line with a 24-character string representing the schedule (each character is either 'A', 'U', or 'M').
outputFormat
For each test case, output one line containing YES
if there exists a contiguous substring of exactly k or more 'A's in the schedule, otherwise output NO
.## sample
4
3
AAAAAAAAAAAAAAAAAAAAAAAA
5
UUUUUMMMMMMUUUUUMMMMMMAAA
2
UUUUUMMMMMMUUAAAAUUMMMMMM
4
AAAAAUMMMMMUMMMMMUMMMMMMM
YES
NO
YES
YES
</p>