//this is my code please help me find the mistake.

#include <bits/stdc++.h>

using namespace std;

int main()

{

int t;

cin>>t;

for(int i=0;i<t;i++)

{

int n,count=0,sum=0;

cin>>n;

string s;

cin>>s;

for(int j=0;j<n;j++)

{

if(s[j]==‘P’)

{

count++;

}

else if(s[j]==‘A’)

{

if((s[j-1]==‘P’||s[j-2]==‘P’) && (s[j+1]==‘P’||s[j+2]==‘P’))

{

sum++;

}

}

}

if(count>=ceil(n*0.75))
{
cout<<0;
}
else{
if(sum>=ceil(n*0.75)-count)

{

cout<<ceil(n*0.75)-count<<endl;

}

else

{

cout<<-1<<endl;

}

}

```
}
return 0;
```

}