My issue
include <stdio.h>
#include<string.h>
int main()
{
char s1[50],s2[50];
scanf(“%S”,s1);
int l=strlen(s1);
int n;
scanf(“%d”,&n);
while(n>0)
{
int i;
for(i=0;s1[i]!=0;i++)
{
if(s2[i]==s1[l-1]);
l–;
}
if(strcmp(s1,s2)==0)
printf(“\nPalindrome”);
else
printf(“\nNot Palindrome”);
n–;
return 0;
}
}
My code
#include <stdio.h>
#include<string.h>
int main()
{
char s1[50],s2[50];
scanf("%S",s1);
int l=strlen(s1);
int n;
scanf("%d",&n);
while(n>0)
{
int i;
for(i=0;s1[i]!=0;i++)
{
if(s2[i]==s1[l-1]);
l--;
}
if(strcmp(s1,s2)==0)
printf("\nPalindrome");
else
printf("\nNot Palindrome");
n--;
return 0;
}
}
Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS156