Wrong answer in submission

I am solving this problem. The code can pass all sample test cases, but get WA in sbmission.
Here is the code:

#include <bits/stdc++.h>
using namespace std;

int main() {
	freopen("testcases.txt", "r", stdin);

	int testcase;
	scanf("%d", &testcase);

	while(testcase--) {
		int N;
		scanf("%d", &N);

		string str;
		cin >> str;
		
		int count;
		int size = (int)str.size();
		for(int i = 0; i < size; i++) {
			if(str[i] == 'Q') {
				count++;
			}else {
				count--;
			}
		}

		if(count < 0) {
			count = 0;
		}
		
		
		if(count <= 0) {
			printf("Yes\n");
		}else {
			printf("No\n");
		}	
	}

	return 0;
}

I can’t run your code without getting a TLE. Please link your submission, next time.

Here is a testcase that you do not solve, Input:

1
3
QAA

Expected output:

No

Your output:

Yes

@termii
It was mentioned, “It is guaranteed that the dialog begins with the question of the client