Palindrome Judgment
Time Limit: 1000 ms
Memory Limit: 65536 KiB
Problem Description
Enter a string of characters (less than 100 in length) to determine whether the string of characters is a palindrome (the content of the forward and reverse reads is the same).
Input
Enter a string of characters (less than 100 in length).
Output
Output "yes" if the string is a palindrome, otherwise output "no".
Sample Input
asdfgfdsa
Sample Output
yes
Hint
Source
#include<bits/stdc++.h>
using namespace std;
int main(){
char a[100];
char b[100];
gets(a);
int j=0,i;
for(i=strlen(a) - 1;i>=0;i--){
b[j++]=a[i];
}
b[j]='\0';
if(strcmp(a,b)==0)
printf("yes\n");
else
printf("no\n");
return 0;
}