Is Palindrome | Toph | Easy Problem c++
Given a word, print if it is a palindrome, otherwise .
A palindrome is a word which reads the same backward as forward, e.g. racecar.
Input
The input will contain a string ().
will contain lowercase alphabets only.
Output
Print or .
Code C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,p;
cin>>a;
p=a;
reverse(a.begin(),a.end());
if(a==p){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
return 0;
}
0 Comments