Palindrome
tuhuuduc
c_cpp
2 years ago
288 B
5
Indexable
#include <iostream>
#include <string>
int main(){
std::string str;
std::cin>>str;
int len = str.length();
bool flag = true;
for (int i = 0 ; i < len/2; i++){
if (str[i] != str[len-i-1])
flag = false;
}
std::cout<< (flag ? "YES" : "NO");
}Editor is loading...
Leave a Comment