Advertisement
Guest User

Enchanted Mirror 20.08.13

a guest
Aug 20th, 2013
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6. #include <bitset>
  7. #include <iostream>
  8. #include <stack>
  9. #include <queue>
  10. #include <set>
  11. #include <map>
  12. #include <string>
  13. #include <algorithm>
  14. using namespace std;
  15.  
  16. char a[110], b[110];
  17. vector< pair<char, char> > v1, v2;
  18. int l;
  19.  
  20. int main() {
  21.     freopen("enchanted.in", "r", stdin);
  22.     freopen("enchanted.out", "w", stdout);
  23.     scanf("%s\n%s\n", a, b);
  24.     l = strlen(a);
  25.     for (int i = 0; i < l; i++)
  26.         v1.push_back(make_pair(a[i], b[l - 1 - i]));
  27.     scanf("%s\n%s\n", a, b);
  28.     for (int i = 0; i < l; i++)
  29.         v2.push_back(make_pair(a[i], b[l - 1 - i]));
  30.     sort(v1.begin(), v1.end());
  31.     sort(v2.begin(), v2.end());
  32.     for (int i = 0; i < v1.size(); i++) {
  33.         if (v1[i] != v2[i]) {
  34.             printf("No");
  35.             return 0;
  36.         }
  37.     }
  38.     printf("Yes");
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement