Help me with Even-tual Reduction problem

#include <stdio.h>

int main(void) {
	// your code goes here
	int t;
	scanf("%d", &t);
	while(t--)
	{
	    int n;
	    scanf("%d", &n);
	    int f = n;
	    char s[n];
	    scanf("%s", &s);
	   /* if(n % 2 != 0)
	    {
	        printf("No\n");
	    }
	    else
	    {*/
	        int countchar[1000] = {0};
	        for(int i = 0;i < n && n %2 == 0;i++)
	        {
	            int c;
	            c = s[i];
	            countchar[c]++;
	        }
	        for(int i = 97;i <= 122;i++)
	        {
	            if(countchar[i] % 2 == 0)f = f - countchar[i];//flag = 1;
	            else f = f - countchar[i] + 1;// flag = 0;
	        }
	        if(f == 0)printf("Yes\n");
	        else printf("No\n");
	    //}
	}
	return 0;

}

My code is working for the given test cases, but it is not working for hidden test cases. Can you help me solve the issue?

Your logic is correct
the problem you are facing is wrong output
you should print YES capital
not Yes

1 Like