Codechef Lapin Problem Help.

Hey, This is my first attempt at submission. The question is Lapin. I got a wrong answer although my solution seemed to match with the one given in the question. I have a doubt with the constraints mentioned in the question. The constraint says that the length of the string can be 2<= S <=1000. Does this mean that the user is expected to enter only within the range? Or do we have to make sure that the user is prompted to enter the values in the particular range?

I am attaching the code as well.

int main(void)
int testCases;
     char *word = malloc(1000);
    scanf(" %s",word);
    int i;
    int length = strlen(word);
    int left =0,right =0;
            left  += word[i];
            right += word[i];
    if (length%2 !=0)
        right -=word[length/2];
    if(left ==right)
    return 0;

If the constraints are fine here then i believe that the problem lies in the logic of the program.

I see that you are adding the ASCII values of characters on the left and right halves of the strings. But this won’t simply work. Suppose I have a string acbb. Then ASCII left=97+99=196. And ASCII right=98+98=196. Left=Right implies the string is a lapindrome. However, it is not, as you can see clearly. So the logic isn’t working, you see!