def solve(s):
abc = "abcdefghijklmnopqrstuvwxyz"
index = dict()
unique = set()
for i in range(len(abc)):
index[abc[i]] = i
for si in s:
unique.add(si)
n_unique_elements = len(unique)
for j in range(len(s) - n_unique_elements + 1):
substring = s[j:j+n_unique_elements]
for element in unique:
if substring.count( element ) > 1:
return 'NO'
return 'YES'
for t in range(int(input())):
s = input()
print(solve(s))
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
map<int,int>mp;
for(int i=0;i<s.size();i++){
mp[s[i]]++;
}
int n=mp.size();
//%me kyo padta hai baba
bool give=true;
map<int,int>mpp,s1;
for(int i=0;i<s.size();i++){
if(s1[s[i]]==0){
mpp[s[i]]=i;
s1[s[i]]++;}//ok
else{
if(mpp[s[i]]==i-n){
mpp[s[i]]=i;
}else{give=false;break;}
}
}
if(give){cout<<"YES"<<endl;}
else{cout<<"NO"<<endl;}
}
}
1144A - Diverse Strings | 1553B - Reverse String |
1073A - Diverse Substring | 630N - Forecast |
312B - Archer | 34D - Road Map |
630I - Parking Lot | 160B - Unlucky Ticket |
371B - Fox Dividing Cheese | 584B - Kolya and Tanya |
137B - Permutation | 550C - Divisibility by Eight |
5A - Chat Servers Outgoing Traffic | 615A - Bulbs |
5B - Center Alignment | 549A - Face Detection |
535B - Tavas and SaDDas | 722C - Destroying Array |
366A - Dima and Guards | 716B - Complete the Word |
1461C - Random Events | 1627A - Not Shading |
141B - Hopscotch | 47B - Coins |
1466C - Canine poetry | 74A - Room Leader |
1333D - Challenges in school №41 | 1475B - New Year's Number |
461A - Appleman and Toastman | 320B - Ping-Pong (Easy Version) |