Advertisement
Ahmed_Negm

c

May 26th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.78 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cmath>
  4. #include<iomanip>
  5. #include<algorithm>
  6. #include<cstdlib>
  7. #include<cstring>
  8. #include<vector>
  9. #include<utility>
  10. using namespace std;
  11.  
  12. #define ll long long
  13. #define nl '\n'
  14. #define sz(x) int(x.size())
  15. #define all(x) x.begin(),x.end()
  16. #define rall(s)  s.rbegin(), s.rend()
  17. #define getline(s) getline(cin>>ws,s)
  18. #define ceill(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
  19. #define pi  3.141592653589793
  20.  
  21. /*
  22. ███╗░░██╗███████╗░██████╗░███╗░░░███╗
  23. ████╗░██║██╔════╝██╔════╝░████╗░████║
  24. ██╔██╗██║█████╗░░██║░░██╗░██╔████╔██║
  25. ██║╚████║██╔══╝░░██║░░╚██╗██║╚██╔╝██║
  26. ██║░╚███║███████╗╚██████╔╝██║░╚═╝░██║
  27. ╚═╝░░╚══╝╚══════╝░╚═════╝░╚═╝░░░░░╚═╝
  28.  
  29. */
  30.  
  31. void Fast_IO(){
  32. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  33. freopen("self.in", "r", stdin);
  34. // #ifndef ONLINE_JUDGE
  35. // freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  36. // #endif
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43. void solve(){
  44.   string s; cin>>s;
  45.   map<ll,ll>mp;
  46.   for(int i=0; i<sz(s); i++){
  47.     mp[s[i]-'0']++;
  48.   }
  49.   bool flag = 1;
  50.   for(int i=0; i<sz(s); i++){
  51.     if(mp[i] != s[i]-'0'){
  52.       flag =0;
  53.       break;
  54.     }
  55.   }
  56.   if(flag) cout<<"self-describing"<<nl;
  57.   else cout<<"not self-describing"<<nl;
  58.  
  59.  
  60.  
  61.  
  62. }
  63.  
  64. int main(){
  65.     Fast_IO();
  66. int t =1;
  67. cin>>t;
  68. while(t--){
  69. solve();
  70. }
  71. return 0;
  72. }  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement