Palindrome
tuhuuduc
c_cpp
a year ago
288 B
4
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