T3000

qbf with map

Apr 2nd, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5.  
  6. int main()
  7. {
  8.     string wt{"abcdefghijklmnopqrstuvwxyz"};
  9.     map<char, ll> z1;
  10.  
  11.     string fa;
  12.     ll n;
  13.     cin >> n;
  14.     string h;
  15.  
  16.     while (n-- > 0)
  17.     {
  18.  
  19.         for (int i = 0; i < 26; i++)
  20.         {
  21.             z1[wt.at(i)] = 0;
  22.         }
  23.  
  24.         getline(cin >> ws, h);
  25.  
  26.         for (int i = 0; i < h.length(); i++)
  27.         {
  28.             z1[tolower(h.at(i))] += 1;
  29.         }
  30.         for (auto it : z1)
  31.         {
  32.             if (it.second == 0)
  33.             {
  34.                 fa += it.first;
  35.             }
  36.         }
  37.         sort(fa.begin(), fa.end());
  38.         if (fa.size() == 0)
  39.         {
  40.             cout << "pangram" << endl;
  41.         }
  42.         else
  43.         {
  44.             cout << "missing " << fa << endl;
  45.         }
  46.  
  47.         fa.clear();
  48.         z1.clear();
  49.     }
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment