Palindrome String

Program:-

You have been given a String S. You need to find and print whether this string is a palindrome or not. If yes, print “YES” (without quotes), else print “NO” (without quotes).
Input Format
The first and only line of input contains the String S. The String shall consist of lowercase English alphabets only.
Output Format
Print the required answer on a single line.
Constraints 

1|S|100


Note
String S consists of lowercase English Alphabets only.

SAMPLE INPUT
 
aba
SAMPLE OUTPUT
 
YES
Time Limit:1.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB

BEST SUBMISSION

SIMILAR PROBLEMS

CONTRIBUTORS

Solution:-

#inc lude<string.h>
#include<stdio.h>
void main()
{
char s[100],a[100];
int l,j,i;
scanf(“%s”,s);
l=strlen(s);
j=l1;
for(i=0;i<=l/21;i++)
{
if(s[i]!=s[j])
break;
j–;
}
if(i==l/2)
printf(“YES”);
else
printf(“NO”);
}

Leave a Reply

Your email address will not be published.