Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char* mas = new char[10000];
- int i = 0, sum = 0;
- for (int j = 0; j < 10000; j++)
- {
- mas[j] = 0;
- }
- cin.get(mas[0]);
- while (mas[i] != '\n')
- {
- i++;
- cin.get(mas[i]);
- sum++;
- }
- for (int i = 0; i < sum; i++)
- {
- if (mas[i] == ' ')
- {
- for (int j = i; j < sum; j++)
- {
- mas[j] = mas[j + 1];
- }
- i--;
- sum--;
- }
- if (mas[i] >= 'A' && mas[i] <= 'Z')
- {
- mas[i] += 32;
- }
- }
- for (int i = 0; i < sum; i++)
- {
- if (mas[i] != mas[sum - i - 1])
- {
- cout << "NO";
- delete[] mas;
- return 0;
- }
- }
- cout << "YES";
- delete[] mas;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement