Horje
c++ check palindrome Code Example
check if a string is palindrome cpp
// Check whether the string is a palindrome or not.
#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin >> s;
    
    int l = 0;
    int h = s.length()-1;

    while(h > l){
        if(s[l++] != s[h--]){
            cout << "Not a palindrome" << endl;
            return 0;
        }
    }
    cout << "Is a palindrome" << endl;
    return 0;

}
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;
}




Cpp

Related
how to take space separated input in c++ Code Example how to take space separated input in c++ Code Example
length of array in cpp Code Example length of array in cpp Code Example
Palindrome Checker Code Example Palindrome Checker Code Example
min heap priority queue c++ Code Example min heap priority queue c++ Code Example
check if set contains element c++ Code Example check if set contains element c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8