def checkcount(strr):
d={}
for i in strr:
if(i in d):
d[i]=d[i]+1
else:
d[i]=1
for i in d:
if(d[i]%2!=0):
return False
return True
def checkempty(string):
if(len(string)==0):
return True
s=string[::-1]
if(s==string):
if(len(string)%2==0):
return True
return False
if(len(string)%2==0):
g=string
ans1=checkcount(g)
if(ans1):
return True
return False
else:
return False
lst=[]
a=int(input())
for i in range(a):
b=int(input())
c=input()
lst.append(c)
for i in lst:
ans=checkempty(i)
if(ans):
print("YES")
else:
print("NO")
For the given test cases this code was running fine but when i submmited the submission was unsuccessful. can someone tell what is the error in the logic??