Horje
check if a string is palindrome cpp 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;

}




Cpp

Related
access first value in a set c++ Code Example access first value in a set c++ Code Example
split string on character vector C++ Code Example split string on character vector C++ Code Example
how to run a msi file raspbrain Code Example how to run a msi file raspbrain Code Example
elements of set c++ Code Example elements of set c++ Code Example
c++ unordered_map check if key exists Code Example c++ unordered_map check if key exists Code Example

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