Advertisement
Guest User

003

a guest
Dec 8th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. char* mas = new char[10000];
  9. int i = 0, sum = 0;
  10. for (int j = 0; j < 10000; j++)
  11. {
  12. mas[j] = 0;
  13. }
  14. cin.get(mas[0]);
  15. while (mas[i] != '\n')
  16. {
  17. i++;
  18. cin.get(mas[i]);
  19. sum++;
  20. }
  21. for (int i = 0; i < sum; i++)
  22. {
  23. if (mas[i] == ' ')
  24. {
  25. for (int j = i; j < sum; j++)
  26. {
  27. mas[j] = mas[j + 1];
  28. }
  29. i--;
  30. sum--;
  31. }
  32. if (mas[i] >= 'A' && mas[i] <= 'Z')
  33. {
  34. mas[i] += 32;
  35. }
  36. }
  37. for (int i = 0; i < sum; i++)
  38. {
  39.  
  40. if (mas[i] != mas[sum - i - 1])
  41. {
  42. cout << "NO";
  43. delete[] mas;
  44. return 0;
  45. }
  46. }
  47. cout << "YES";
  48. delete[] mas;
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement