Gịgj

Kdjd
Last edited on
#include <iostream>
#include <string>




using namespace std;

//Viet code vao day

bool isPalindrome(string s){
for(int i = 0; i < s.length(); i++){
if(s[i] != s[ s.length() - i - 1])
return false;
}
return true;
}



int main() {
//Nhap vao mot xau ky tu tren 1 dong
string s;
getline(cin, s);

//In ra true neu s la xau doi xung
cout << (isPalindrome(s) ? "true" : "false");

return 0;
}
Topic archived. No new replies allowed.