Friday, 7 July 2017

Palindrome

#include<iostream>
#include<string>
using namespace std;
int main(){
string s;
cin>>s;
int b=0;
for(int i=0;i<s.size();i++){if(s[i]!=s[s.size()-i-1])

{b=1;
break;}
}
if(b==0){
    cout<<"yes";
}
else cout<<"N0";
    }
    

No comments:

Post a Comment

Dynamic programming problem

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Please...