githubNonFunziona/2-4-e.spp

32 lines
581 B
Plaintext
Raw Normal View History

2024-12-05 10:57:14 +00:00
#include <iostream>
#include <string>
#include <vector>
int main() {
std::string clovo;
std::getline(std::cin, clovo);
int a = 0;
int b = clovo.size() - 1;
bool yesOrNo = true;
while (a < b) {
if (clovo[a] == ' ') {
++a;
} else if (clovo[b] == ' ') {
--b;
} else if (clovo[a] != clovo[b]) {
yesOrNo = false;
break;
} else {
++a;
--b;
}
}
if (yesOrNo) {
std::cout << "YES\n";
} else {
std::cout << "NO\n";
}
}