Advertisement
Robert_JR

1338 - Hidden Secret

Oct 1st, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstring>
  3. #include <cstdlib>
  4. #include <algorithm>
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int t_case, t = 1;
  11.     string ch1;
  12.     string ch2;
  13.     cin >> t_case;
  14.     char c;
  15.     c = getchar();
  16.     while(t_case--)
  17.     {
  18.         getline(cin, ch1, '\n');
  19.         getline(cin, ch2, '\n');
  20.  
  21.         // cout << ch1 << endl << ch2 << endl;
  22.  
  23.         ch1.erase(remove(ch1.begin(), ch1.end(), ' '), ch1.end());
  24.         ch2.erase(remove(ch2.begin(), ch2.end(), ' '), ch2.end());
  25.  
  26.         transform(ch1.begin(), ch1.end(), ch1.begin(), ::tolower);
  27.         transform(ch2.begin(), ch2.end(), ch2.begin(), ::tolower);
  28.  
  29.         sort(ch1.begin(), ch1.end());
  30.         sort(ch2.begin(), ch2.end());
  31.  
  32.         if(ch1 == ch2)
  33.             printf("Case %d: Yes\n", t++);
  34.         else
  35.             printf("Case %d: No\n", t++);
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement