A. Diverse Strings

A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz", "r" and "dabcef". The following string are not diverse: "az", "aa", "bad" and "babc". Note that the letters 'a' and 'z' are not adjacent.

Formally, consider positions of all letters in the string in the alphabet. These positions should form contiguous segment, i.e. they should come one by one without any gaps.

You are given a sequence of strings. For each string, if it is diverse, print "Yes". Otherwise, print "No".

Input

The first line contains integer nn (1≤n≤1001≤n≤100), denoting the number of strings to process. The following nn lines contains strings, one string per line. Each string contains only lowercase Latin letters, its length is between 11 and 100100, inclusive.

Output

Print nn lines, one line per a string in the input. The line should contain "Yes" if the corresponding string is diverse and "No" if the corresponding string is not diverse. You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.

Example

input

8
fced
xyz
r
dabcef
az
aa
bad
babc

output

Yes
Yes
Yes
Yes
No
No
No
No

代码:

 

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))

int main()
{
	int n,i;
	string a;
	cin>>n;
	while(n--)
	{
		cin>>a;
		set<char>s;
		for(i=0;i<a.length();i++)
			s.insert(a[i]);
		if(s.size()==a.length())
		{
			set<char>::iterator it;
			int flag=0,ff=0;
			char x;
			for(it=s.begin();it!=s.end();it++)
			{
				//cout<<*it; 
				if(!ff)
				{
					x=*it;
					ff=1;
					continue;
				}
				if(*it!=x+1)
					flag=1;
				else
					x=*it;
			}
			if(!flag)
				cout<<"Yes"<<endl;
			else
				cout<<"No"<<endl;
		}
		else
			cout<<"No"<<endl;
	}
	return 0;
}