Source Code
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N=2e5+9;


int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        string s;
        cin>>s;
        bool ok=true;
        sort(s.begin(),s.end());
        char cur='A';
        for(int i=0;i<s.size();i++){
            if(s[i]!=cur)ok=false;
            cur++;
        }
        cout<<(ok?"YES":"NO")<<'\n';
    }
}
Copy
Well-indexed? Ahmed_Allawati
GNU G++17
4 ms
416 KB
Accepted