Advertisement
_takumi

Анаграммы

Aug 1st, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. string word1, word2;
  8. map<char, int> m1, m2;
  9. while (cin >> word1 >> word2) {
  10.     for (const char& c : word1) {
  11.         ++m1[c];
  12.     }
  13.     for (const char& c : word2) {
  14.         ++m2[c];
  15.     }
  16.     if (m1 == m2) cout << "YES\n";
  17.     else cout << "NO\n";
  18. }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement