Guest User

Untitled

a guest
Apr 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main () {
  7.     int n;
  8.     cin >> n;
  9.     while (n!=0) {
  10.         vector<int> v(26,0);
  11.         char c;
  12.         while(cin >> c and c != '.') {
  13.             if (c >= 65 and c <= 90) ++v[c-65];
  14.             if (c >= 97 and c <= 122) ++v[c-97];
  15.         }
  16.         while(cin >> c and c != '.') {
  17.             if (c >= 65 and c <= 90) --v[c-65];
  18.             if (c >= 97 and c <= 122) --v[c-97];
  19.         }
  20.         bool anagrama = true;
  21.         for (int i = 0; i < 26 and anagrama; ++i) {
  22.             anagrama = (v[i] == 0);
  23.         }
  24.         if (anagrama) cout << "SI" << endl;
  25.         else cout << "NO" << endl;
  26.         --n;
  27.     }
  28. }
Add Comment
Please, Sign In to add comment