Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ check palindrome

#include<iostream>
#include<ctype.h>
using namespace std;
int main() {
	string s; cin >> s;
	int a = 0;
	for(int i = 0; i < (s.length() / 2); i++) 
		if(s[i] == s[s.length() - 1 - i]) a++;
	if(a == (s.length() / 2)) cout << "YES";
	else cout << "NO";
	return 0;
}
 
PREVIOUS NEXT
Tagged: #check #palindrome
ADD COMMENT
Topic
Name
7+6 =