This code was running perfectly in VS code but was showing error EOF in line 3 in the CodeChef IDE. Line 3 is the input for t. When I submitted the code it was accepted and it was right. Is this a problem with the CodeChef IDE, because it wasted a lot of my time and it was frustrating cuz it was my first time participating here.
from collections import Counter
t = int(input())
for i in range(0,t):
n = int(input())
s = str(input())
if n % 2:
x = "NO"
else:
arr = Counter(s)
for k in arr:
if arr[k] % 2:
x = "NO"
break
else:
x = "YES"
print(x)
well, i dont know much about C++ but i believe that your code will output Yes or No for only the frequency of the first letter and wont check other letters because you are breaking it. Wha you need to do is check if a frequency is not divisibile by 2, print no and then break the code else print yes. You need to store YES and No in a universal string and print it outside the loop
Here you are not considering frequency of character ‘z’ in string.For example
TC: n=1 ,z ,answer will be “NO”.but since you are not considering frequency of ‘z’ so it is giving “YES” as answer.
correct it , line number:18 by b[a[i]-97] or increase the size of hash array by 1.