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 Ruby (2.3.3) (judge verdict: Wrong Answer)

a,b = gets.split(" ")
#上から３桁の数字を取得する
#下二桁のと比較をする

a_a = a.split("")
b_a = b.split("")

a123_s = a_a[0] + a_a[1] + a_a[2]
b123_s = b_a[0] + b_a[1] + b_a[2]

a45_s = a_a[3] + a_a[4]
a12_s = a_a[0] + a_a[1]

b45_s = b_a[3] + b_a[4]
b12_s = b_a[0] + b_a[1]

#文字列を整数へ
a123_i = a123_s.to_i
b123_i = b123_s.to_i

a45_i = a45_s.to_i
a12_i = a12_s.to_i

b45_i = b45_s.to_i
b12_i = b12_s.to_i
 
ans = 0

if  a45_i <= a12_i
    ans = ans + 1
end

if  b45_i >= b12_i
    ans = ans + 1
end

ans = ans + b123_i - a123_i - 1

puts ans