Problem:
Score : 200 points

Problem Statement

Find the number of palindromic numbers among the integers between A and B (inclusive).
Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.

Constraints

10000 \leq A \leq B \leq 99999

All input values are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the number of palindromic numbers among the integers between A and B (inclusive).

Sample Input 1

11009 11332

Sample Output 1

4

There are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.

Sample Input 2

31415 92653

Sample Output 2

612

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LINE_BUF_SIZE 256

int main(){

    int i,j,k;
    char line[256];
    int A,B,len,len_hold;

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d",&A,&B);

    i=0;

    while((strncmp(&line[i]," ",1))!=0){
        i+=1;
    }

    len = i;    /*Aの長さ*/
    len_hold = len;

    if(len % 2 == 0)len = len/2;    /*偶数の場合*/
    else len = len/2+1;     /*奇数の場合*/
    
   // printf("%d\n",len);

    int A_2;
    A_2 = A;
    int arrow=0;;
    char value[10];
    int count = 0;

        while(A_2 < B){
            A_2 += 1;
            sprintf(value,"%d",A_2);
            if(value[0]==value[4] && value[1]==value[3])arrow += 1; 
        }

    printf("%d",arrow);

    return 0;

}