PALINDROME STRING OR NOT
Given a String with or without special characters find if it is Palindrome or Not. No splitting of the array must be done or No additional spaces must be used for storing the array.
Sample Input:
Sample Output:
#include <stdio.h>
#include <string.h>
int main()
{
char str[100];
int i, len, flag;
flag = 0;
scanf("%s",str);
len = strlen(str);
for(i = 0; i < len; i++)
{
if(str[i] != str[len - i - 1])
{
flag = 1;
break;
}
}
if(flag == 0)
{
printf("Yes");
}
else
{
printf("No");
}
return 0;
}
Subscribe Our Newsletter
0 Comment
Post a Comment