I need to get the length of the palindrome of the word in a string. Ex. tomyot length =2. I wrote the following code but it doesn't work.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
char str[20] = "tomyot";
char rstr[20];
strcpy(rstr, str);
strrev(rstr);
int i,j;
int count = 0;
int s=0;
for(i=0;i<strlen(str); i++){
for(j=s;j<strlen(str); j++){
if(str[i] == rstr[j]){
count+=1;
s = j+1;
continue;
}
}
}
printf("%d",count);
return 0;
}