Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. //ALEX ENACHE
  2.  
  3. #include <vector>
  4. #include <algorithm>
  5. #include <queue>
  6. #include <map>
  7. #include <set>
  8. #include <unordered_map>
  9. #include <time.h>
  10. #include <iomanip>
  11. #include <deque>
  12. #include <math.h>
  13. #include <cmath>
  14. #include <assert.h>
  15. #include <stack>
  16. #include <bitset>
  17. #include <random>
  18. #include <chrono>
  19.  
  20. using namespace std;
  21.  
  22. //-------------------------------------------------------------------
  23.  
  24. #include <iostream>
  25. //#include <fstream>
  26. //ifstream cin ("elmaj.in");ofstream cout ("elmaj.out");
  27.  
  28.  
  29.  
  30. int main() {
  31.  
  32.     //freopen("input", "r", stdin);freopen("output", "w", stdout);
  33.  
  34.     int n;
  35.     cin>>n;
  36.  
  37.     for (int i=1; i<=n; i++){
  38.         string s;
  39.         cin>>s;
  40.         sort (s.begin() , s.end());
  41.  
  42.         int ok = 0;
  43.  
  44.         for (int j=1; j<s.size(); j++){
  45.             if (s[j] - s[j-1] != 1){
  46.                 cout<<"No"<<'\n';
  47.                 ok = 1;
  48.                 break;
  49.             }
  50.         }
  51.  
  52.         if (!ok){
  53.             cout<<"Yes"<<'\n';
  54.         }
  55.     }
  56.  
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement