SHARE
TWEET

codeforce - diverse Strings

jakaria_hossain Mar 31st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n;
  6.     cin>>n;
  7.     while(n--)
  8.     {
  9.         string s;
  10.         cin>>s;
  11.         int x= s.size();
  12.         int ara[x+1],i;
  13.         for(i=0;i<x;i++)
  14.         {
  15.             ara[i]=s[i];
  16.         }
  17.         sort(ara,ara+x);
  18.         for(i=0;i<x-1;i++)
  19.         {
  20.             if(ara[i]+1!=ara[i+1])break;
  21.         }
  22.         if(i==x-1)printf("Yes\n");
  23.         else printf("No\n");
  24.     }
  25.     return 0;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top