String is polindrom

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

void polindrom(string str){
    string str1 = str;

    reverse(str1.begin(),str1.end());

    if(str1 == str)
        cout<<"Is polindorm"<<endl;
    else
        cout<<"Not POlindrom"<<endl;
}

int main(){
    string str = "ABCDCB";
    polindrom(str);
    return 0;
}

    Leave a Reply

    Your email address will not be published.

    Need Help?