super-string

A string is said to be "SUPER STRING" if the number of times the character appeared in the string is equal to its ASCII value. Given the conditions that the ASCII value of ‘a’ is 26 and z is ‘1’.

Input 

First line takes number of test cases ‘N’.
Following ‘N’ lines take string as input.

Output

‘Yes’ if the string is a super String
‘No’ if string is not a Super String

SAMPLE INPUT
2
ZYY
ZYYZ

SAMPLE OUTPUT
Yes
No

Explanation

'Z' appeared once and 'Y' appeared twice in the first test case so it was a 'Yes' and in second test case 'Z' appeared twice therefore it was a 'No'

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import string
d={}
j=26
for x in string.ascii_uppercase:
	d[x] = j
	j -=1

t =int(input())
for i in range(t):  
    d1 ={}
    count = 0
    s= input()
    for x in s:
	 d1[x]=d1.get(x,0)+1
    for x in list(d1.keys()):
	 if d1[x] == d[x]:
	   count += 1
    if count == len(list(d1.keys())):
	  print('Yes')
    else:
	  print('No')




if __name__=='__main__':
	letter = 'abcdefghijklmnopqrstuvwxyz'
	letters = letter.upper()
	ans = letters[::-1]
	T = int(input())
	for _ in range(T):
		string = input()
		myset = set()
		for i in string:
			myset.add(i)
		flag = 0
		for i in myset:
			if string.count(i) == ans.index(i)+1:
				pass
			else:
				flag = 1
				break
		if flag==1:
			print("No")
		else:
			print("Yes")
		


t = eval(input())
while t>0:
	t-=1
	a = input()
	d = [0]*26
	dc = [0]*26
	j = 26
	for i in range(26):
		dc[i] = j
		j-=1
#	print dc
	for i in range(len(a)):
		d[ord(a[i]) - ord('A')] += 1
#	print d
	flg = True
	for i in range(26):
		if d[i] > 0:
			if d[i] != dc[i]:
				flg = False
				break
	if flg:
		print("Yes")
	else:
		print("No")