Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     freopen("input.txt", "r", stdin);
  10.     freopen("output.txt", "w", stdout);
  11.  
  12.     string S, S1 = "", S2 = "", S3;
  13.     getline(cin, S);
  14.  
  15.     for (int i = 0; i < S.size(); ++i) {
  16.         S2 = S[i];
  17.         if (S2 != " ") {
  18.             S1 += S2;
  19.         }
  20.     }
  21.    
  22.     S2 = "";
  23.  
  24.     for (int i = S.size() - 1; i >= 0; --i) {
  25.         S3 = S[i];
  26.         if (S3 != " ") {
  27.             S2 += S3;
  28.         }
  29.     }
  30.  
  31.     if (S1 == S2) {
  32.         cout << "YES";
  33.     }
  34.     else {
  35.         cout << "NO";
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement