Steps to participate:
-
When you are done compiling Locally Just Perform Git Push and you can wait if it passes all the Test Cases.
-
After that in the repo page reload the window and You will see a compare & pull request button and create a pull request!.😉
- After That in the next screen Open a Pull request in the Following way:-
- In the Commit message the format should be "Full Name - Question No. - C/C++ "
- Example - "Jainal Gosaliya - Question 1 in C"
- Tap on create pull requests and just go to
- Travis to Check if your code Passes the test cases or not?🤷♀️
Start Coding and Best of Luck!❤🤞😉
Vivian is a brilliant university student who does not attend lectures because he believes that they are boring and coding is life so he utilises his time to code some amazing stuff. However, his university follows certain rules and regulations, and a student may only take an exam for a course if he has attended at least 75% of lectures for this course.
Since you are Vivian's best friend, you want to help him reach the attendance he needs to take exams because he was doing something good for the society by staying at home. Unfortunately, Vivian is still focused on his code and refuses to attend more lectures, so the only option is to have some of his friends mark him as present by proxy. This trick is well-known in the university, but only few have the talent to pull it off.
In a certain course, there is exactly one lesson per day over the course of N days (numbered 1 through N). You are given a string S with length N describing the lessons Chef attended — for each valid i, the i-th character of this string is either 'A' if Chef was absent on day i or 'P' if Chef was actually present on day i.
For each day d when Chef is absent, one of Chef's friends can mark him as present by proxy on this day only if he was present (if he was really present, not just marked as present) on at least one of the previous two days, i.e. days d−1 and d−2, and on at least one of the following two days, i.e. days d+1 and d+2. However, it is impossible to mark him as present by proxy on the first two days and the last two days.
Find the minimum number of times Chef has to be marked as present by proxy so that his attendance becomes at least 75% (0.75). Chef's attendance is number of days when he was marked as present, either by proxy or by actually being present, divided by N.
INPUT
The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer D.
The second line contains a single string S with length D.
OUTPUT
For each test case, print a single line containing one integer — the minimum number of times Chef needs to be marked as present by proxy, or −1 if it is impossible to make Chef achieve 75% attendance.
SAMPLE INPUT
2
9
PAAPPAPPP
15
PAAAPPAAAPPAAPA
SAMPLE OUTPUT
1
-1
Change the Git Branch and you are Ready to Go.
How to change Git Branch ?
- Open The Cloned repository in cmd or terminal and type the following command!
git checkout question-2