func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n, j, temp, cnt = 0;       cin >> n;       string s;       cin >> s;       for (int i = 0; i < n; i++) {         temp = 0;         for (int j = 0; j < n - 1; j++) {           if (s[j] ==  A  && s[j + 1] ==  P ) {             s[j + 1] =  A ;             j++;             temp = 1;           }         }         if (temp == 1) {           cnt++;         } else           break;       }       cout << cnt << endl;     }     return 0;   }   