fork(5) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s;
  7. char c;
  8. while (cin >> c)
  9. {
  10. if (c != ' ')
  11. s.push_back(c);
  12. }
  13. if (s.empty())
  14. {
  15. cout << "YES";
  16. return 0;
  17. }
  18. bool palindrom = true;
  19. for (int i = 0; i <= s.length()/2; i++)
  20. {
  21. if (s.at(i) != s.at(s.length()-1-i))
  22. {
  23. palindrom = false;
  24. break;
  25. }
  26. }
  27. cout << (palindrom ? "YES" : "NO");
  28. return 0;
  29. }
Success #stdin #stdout 0s 3464KB
stdin
character
stdout
NO