0
How to make a program for string palindrome in c++
we have to enter a word and then check whether the word is palindrome or not in c++
1 Answer
+ 2
#include <iostream>
using namespace std;
bool isPalindrome(string s) {
for(int i = 0; i < s.size() / 2; ++i)
if(s[i] != s[s.size() - 1 - i])
return false;
return true;
}
int main() {
string s;
cin >> s;
cout << (isPalindrome(s)? "It's palindrome" : "It isn't palindrome");
}