CodeEff/ECCO huggingface dataset:
# Original solution
A, B = list(map(int, input().split()))
numbers = list(range(A, B+1))
count = 0
for i in numbers:
    m = str(i)
    rm = ''.join(list(reversed(m)))
    if m == rm:
        count += 1
print(count)

# Optimized solution
A, B = list(map(int, input().split()))
x = list(range(1,10))
y = list(range(10))
count = 0
for p in x:
    for q in y:
        for r in y:
            sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))
            if A <= sakasama <= B:
                count += 1
print(count)
# Original solution
a,b = list(map(int, input().split()))
cnt =0
for i in range(a,b+1):
  if str(i) ==str(i)[::-1]:
    cnt +=1
print(cnt)

# Optimized solution
a,b = list(map(int, input().split()))
cnt =0
for i in range(a,b+1):
  if str(i)[::-1] ==str(i):
    cnt +=1
print(cnt)
# Original solution
def findSumDigit(num):
    global total
    total = ""
    while num > 0:
        total += str(num % 10)
        num //= 10
    return total

def main():
    a,b = list(map(int, input().split()))
    ans = 0
    for i in range(a,b+1):
        tmp = str(findSumDigit(i))
        if tmp == str(i):
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

# Optimized solution
a, b = list(map(int, input().split()))
ans = 0

for i in range(a,b+1):
    seki_gyaku = str(i)
    if seki_gyaku == seki_gyaku[::-1]:
        ans += 1

print(ans)
# Original solution
A, B = list(map(int, input().split()))

cnt = 0
for n in range(A, B+1):
    n_s = str(n)
    n_s_len = len(n_s)
    for i in range(n_s_len//2):
        if n_s[i] != n_s[n_s_len-i-1]:
            break
    else:
        cnt += 1

print(cnt)


# Optimized solution
A, B = list(map(int, input().split()))

cnt = 0
for n in range(A, B+1):
    n_s = str(n)
    n_s_rvs = n_s[::-1]
    if n_s == n_s_rvs:
        cnt += 1

print(cnt)
# Original solution
A, B = list(map(int, input().split()))

cnt = 0
for n in range(A, B+1):
    n_s = str(n)
    n_s_rvs = n_s[::-1]
    if n_s == n_s_rvs:
        cnt += 1

print(cnt)


# Optimized solution
A, B = list(map(int, input().split()))

cnt = 0
for n in range(A, B+1):
    if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:
        cnt += 1

print(cnt)
# Original solution
A,B = list(map(int,input().split()))
#greedy O(B-A)*len(B)(=5)
kaibun = 0 # num of kaibun
for i in range(A,B+1,1):
  s = str(i)
  #print(s)
  for i in range(len(s)):
    if s[i] != s[len(s)-1-i]:
      break
    if i == len(s)-1:
      kaibun += 1
print(kaibun)
    

# Optimized solution
# 回文数になるA<= <=Bの数の個数
a,b = list(map(int,input().split()))
ans = 0
for i in range(a,b+1,1):
    s = str(i)
    if s == s[::-1]:
        ans += 1
print(ans)
# Original solution
A,B = list(map(int,input().split()))


def kaibun(n):
	key = 0
	for i in range(1,n+1):
		if str(i) == str(i)[::-1]:
			key += 1
	return key

print((kaibun(B)-kaibun(A-1)))

# Optimized solution
A,B = list(map(int,input().split()))


def kaibun(m, n):
	key = 0
	for i in range(m,n+1):
		if str(i) == str(i)[::-1]:
			key += 1
	return key

print((kaibun(A,B)))
# Original solution
A,B = list(map(int,input().split()))


def kaibun(m, n):
	key = 0
	for i in range(m,n+1):
		if str(i) == str(i)[::-1]:
			key += 1
	return key

print((kaibun(A,B)))

# Optimized solution
A,B = list(map(int,input().split()))
 
def kaibun(m, n):
    key = 0
    for i in range(m,n+1):
        s = i//10000  
        t = i%10
        u = i//1000 % 10
        v = i//10 % 10
        if (s==t)&(u==v):
            key += 1
    return key
 
print((kaibun(A,B)))
# Original solution
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range((len(s)+1)//2):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


# Optimized solution
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range(3):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
# Original solution
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        for j in range(3):
            if s[j] != s[-1-j]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


# Optimized solution
#
# abc090 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11009 11332"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """31415 92653"""
        output = """612"""
        self.assertIO(input, output)


def resolve():
    A, B = list(map(int, input().split()))
    ans = 0
    for i in range(A, B+1):
        s = str(i)
        if s[0] == s[-1] and s[1] == s[-2]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()
# Original solution
a,b = list(map(int, input().split()))
count = 0
for i in range(a,b+1):
    j = str(i)
    if j==''.join(reversed(j)):
        count += 1
print(count)

# Optimized solution
a,b = list(map(int, input().split()))
n = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]
print((len(n)))
# Original solution
a,b = list(map(int,input().split()))
n = b - a + 1
count = 0

for i in range(n):
  x = a + i
  xx = list(str(x))
  xx.reverse()
  xx = int("".join(xx))
  if x == xx:
    count += 1
    
print(count)

# Optimized solution
a,b=input().split()
ans=0
for i in range(int(a),int(b)+1):
  if str(i)==str(i)[::-1]:
    ans+=1
print(ans)
# Original solution
A, B = list(map(int, input().split()))
count = 0
for num in range(A, B+1):
    nl = list(str(num))
    kai = [nl[-i] for i in range(1, len(nl)+1)]
    if int("".join(kai))==num:
        count += 1
print(count)

# Optimized solution
A, B = list(map(int, input().split()))
count = 0
for num in range(A, B+1):
    nl = str(num)
    kai = [nl[-i] for i in range(1, len(nl)+1)]
    if int("".join(kai))==num:
        count += 1
print(count)
# Original solution
a, b = list(map(int, input().split()))

d = 0
for i in range(a, b+1):
    c = str(i)
    e = True
    for j in range(len(c)//2):
        if c[j] != c[-j-1] and e:
            e = not e
    if e:
        d += 1
print(d)


# Optimized solution
a, b = list(map(int, input().split()))
d = 0
for i in range(a, b+1):
    c = str(i)
    if c[0] == c[-1] and c[1] == c[-2]:
        d += 1
print(d)
# Original solution
a, b = list(map(int, input().split()))
count = 0
for i in range(a,b+1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        count += 1
    else:
        pass
print(count)


# Optimized solution
a, b = list(map(int, input().split()))
count = 0
for i in range(a,b+1):
    if i//10000 == i%10 and i//1000 %10 == i//10 %10:
        count += 1
print(count)
# Original solution
A, B = list(map(int, input().split()))
cnt = 0
for x in range(A, B + 1):
    X = str(x)
    if X == X[::-1]:
        cnt += 1
print(cnt)

# Optimized solution
A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
  x = str(i)
  if x[0] == x[4] and x[1] == x[3]:
    cnt += 1
print(cnt)
# Original solution
# vim: fileencoding=utf-8


def main():
    a, b = list(map(int, input().split()))
    c = 0
    for i in range(a, b + 1):
        s = str(i)
        r = "".join(reversed(list(s)))
        if s == r:
            c += 1
    print(c)


if __name__ == "__main__":
    main()


# Optimized solution
# vim: fileencoding=utf-8


def main():
    a, b = list(map(int, input().split()))
    c = 0
    for i in range(a, b + 1):
        #     s = str(i)
        #     r = "".join(reversed(list(s)))
        #     if s == r:
        #         c += 1
        if (i % 10) == (i // 10000 % 10) and (i // 10 % 10) == (i // 1000 % 10):
            c += 1
    print(c)


if __name__ == "__main__":
    main()
# Original solution
A,B = list(map(int,input().split()))
ans = 0
for i in range(A,B+1):
    i = str(i)
    if i[0] == i[4]:
        if i[1] == i[3]:
            ans += 1
        else:
            ans += 0
    else:
        ans += 0
print(ans)

# Optimized solution
A,B = list(map(int,input().split()))
ans = 0
for i in range(A,B+1):
    k = str(i)
    if k[0] == k[4] and k[1] == k[3]:
        ans += 1
print(ans)
# Original solution
a, b = list(map(int, input().split()))
cnt = 0
for x in range(a, b + 1):
    s = str(x)
    l = len(s)
    flg = True
    for i in range(l // 2):
        if s[i] != s[l - 1 - i]:
            flg = False
            break
    if flg:
        cnt += 1
print(cnt)


# Optimized solution
a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        cnt += 1
print(cnt)
# Original solution
a,b = list(map(int,input().split()))
count = 0
for i in range(a,b+1):
    if str(i) == str(i)[::-1]:count += 1
print(count)

# Optimized solution
a,b = list(map(int,input().split()))
print((sum([i == i[::-1] for i in map(str,list(range(a,b+1)))])))
# Original solution
A, B = list(map(int, input().split()))
count = 0
for n in range(A, B+1):
    n = str(n)
    if n == n[::-1]:
        count += 1
print(count)


# Optimized solution
A, B = list(map(int, input().split()))
print((sum(n == n[::-1] for n in map(str, list(range(A, B+1))))))
# Original solution
a,b = list(map(int,input().split()))
k = 0

for i in range(a,b+1):
    s = str(i)
    if s[0]==s[-1] and s[1] == s[-2]:
        k += 1
print(('{}'.format(k)))




# Optimized solution
A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B+1):
    moji = str(i)
    if moji[0] == moji[4] and moji[1] == moji[3]:
        ans += 1
print(ans)
# Original solution
a,b = list(map(int,input().split()))
d = 0
for i in range(a,b+1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        d += 1
print(d)

# Optimized solution
s = input().split()
sa,sb = s[0],s[1]
a,b = int(sa),int(sb)
ap = int(sa[0]+sa[1]+sa[2]+sa[1]+sa[0])
bp = int(sb[0]+sb[1]+sb[2]+sb[1]+sb[0])
da = int(a/100)
db = int(b/100)
if ap < a:
    da += 1
if b < bp:
    db -= 1

print((db-da + 1))
# Original solution
a,b = list(map(int,input().split()))
print((sum(i == i[::-1] for i in map(str,list(range(a,b+1))))))

# Optimized solution
a,b = list(map(int,input().split()))
print((len([i for i in map(str,list(range(a,b+1)))if i == i[::-1]])))
# Original solution
a,b = list(map(int, input().split()))
c = 0
while a <= b:
    if str(a)[::-1] == str(a):
        c += 1
    a += 1
print(c)

# Optimized solution
a,b = list(map(int, input().split()))
c = 0
for i in map(str,list(range(a,b+1))):
    if i==i[::-1]:
        c += 1
print(c)
# Original solution
def main():
    #1. input
    a, b = list(map(int, input().split()))
    
    ans = 0
    
    #2. from A to B
    for i in range(a, b+1):
        #2.1. judge if the number is palindromic
        if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):
            ans = ans+1
        
    #3. output
    print(ans)


if __name__ == '__main__':
    main()

# Optimized solution

A,B = list(map(int, input().split()))

ans = 0
for n in range(A,B+1):
    norm = str(n)
    rev = norm[::-1]
    
    if norm == rev:
        ans += 1
        
print(ans)
# Original solution
a,b=list(map(int,input().split()))
ans=0
for i in range(a,b+1):
  ir=str(i)
  ir=ir[::-1]
  ir=int(ir)
  if i == ir:
    ans+=1
print(ans)

# Optimized solution
a,b=list(map(int,input().split()))
ans=0
for i in range(a,b+1):
  ir=str(i)
  if ir == ir[::-1]:
    ans+=1
print(ans)
# Original solution
a,b = list(map(int,input().split()))

ans = 0

for i in range(a,b+1):
    li = list(str(i))
    if(li[0] == li[4] and li[1] == li[3]):
        ans += 1
        
print(ans)

# Optimized solution
a, b = list(map(int, input().split()))
ans = 0

for i in range(a, b + 1):
    val = str(i)
    if (val[0] == val[4] and val[1] == val[3]):
        ans += 1

print(ans)
# Original solution
a,b = list(map(int,input().split()))
count = 0
for i in range(a,b+1):
    if str(i) == str(i)[::-1]:
         count += 1
print(count)


# Optimized solution
a,b = list(map(int,input().split()))
print((sum(i==i[::-1] for i in map(str,list(range(a,b+1))))))
# Original solution
a, b = list(map(int, input().split()))

result = 0
for i in range(a, b + 1):
    i_str = str(i)
    border = len(i_str) // 2

    first_half = i_str[:border]
    if len(i_str) % 2 != 0:
        border += 1
    second_half = i_str[border:]

    compared = second_half[::-1]
    if first_half == compared:
        result += 1

print(result)


# Optimized solution
a, b = list(map(int, input().split()))

result = 0
for i in range(a, b + 1):
    i_str = str(i)
    idx_of_half = len(i_str) // 2
    first_half = i_str[:idx_of_half]
    if len(i_str) % 2 != 0:
        idx_of_half += 1
    second_half = i_str[idx_of_half:]

    if first_half == second_half[::-1]:
        result += 1

print(result)
# Original solution
a, b = list(map(int,input().strip().split(' ')))
a_rev = ""
i = 0
j = 0
cnt = 0

#chk = []

for i in range(b - a + 1):
    
    
    for j in range(len(str(a))):
        a_rev = a_rev + str(a)[len(str(a)) - 1 - j]   

    if str(a_rev) == str(a):
        cnt+=1
#        chk.append(a_rev)   #test
    else:
        pass
    a+=1
    a_rev =""
    
print(cnt)
#print(chk)

# Optimized solution
a,b = list(map(int,input().split()))

cnt = 0

for i in range(a,b+1):
    i = str(i)
    if i == i[::-1]:
        cnt += 1
        
print(cnt)
# Original solution
n, m = list(map(int, input().split()))
ans = 0
for i in range(n, m+1):
    if str(i)[0]+str(i)[1] == str(i)[-1]+str(i)[-2]: ans += 1
print(ans)

# Optimized solution
a, b = list(map(int, input().split()))
ans = 0
for n in range(a, b+1):
    if str(n) == str(n)[::-1]: ans += 1
print(ans)
# Original solution
a,b=list(map(int,input().split()));c=0
while a<=b:s=str(a);c+=s==s[::-1];a+=1
print(c)

# Optimized solution
a,b=list(map(int,input().split()));print((sum(s==s[::-1]for s in map(str,list(range(a,b+1))))))
# Original solution
counter = 0
c = list(map(int, input().split(' ')))
for i in range(c[0], c[1] + 1):
  if str(i)[0] != str(i)[4]:
    continue
  if str(i)[1] != str(i)[3]:
    continue
  counter += 1

print(counter)

# Optimized solution
a = list(map(int, input().split()))
counter = 0
for i in range(a[0], a[1] + 1):
  stri = str(i)
  if (stri[0] == stri[4] and stri[1] == stri[3]):
    counter += 1
    
print(counter)
# Original solution
A,B = list(map(int,input().split()))
print(([str(n)==str(n)[::-1] for n in range(A,B+1)].count(True)))

# Optimized solution
A,B = list(map(int,input().split()))
ans = 0
for n in range(A,B+1):
    s = str(n)
    if s == s[::-1]:
        ans += 1
print(ans)
# Original solution
A, B = list(map(int, input().split()))
counter = 0
for num in range(A, B + 1):
    if str(num) == str(num)[::-1]:
        counter += 1

print(counter)


# Optimized solution
A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
    if str(i) == str(i)[::-1]:
        ans += 1
print(ans)
# Original solution
a,b = list(map(int, input().split()))
n = 0
for i in range(a, b + 1):
    f = True
    s = str(i)
    l = len(s)
    for j in range(l//2 + 1):
        if s[j] != s[- j - 1]:
            f = False
            break
    if f:
        n += 1
print(n)

# Optimized solution
a,b = list(map(int, input().split()))
n = 0
for i in range(1, 10):
    for j in range(10):
        for k in range(10):
            s = 10000 * i + 1000 * j + 100 * k + 10 * j + i
            if a <= s <= b:
                n += 1
print(n)
# Original solution
print((sum(s[0]==s[4]and s[1]==s[3]for s in map(str,list(range(*list(map(sum,enumerate(map(int,input().split()))))))))))

# Optimized solution
print((sum(s[0]==s[4]for s in map(str,list(range(*list(map(sum,enumerate(map(int,input().split())))))))if s[1]==s[3])))
# Original solution
# 回文かどうかを調べる関数
def is_palindrome(s: str) -> bool:
    return s[:len(s)//2] == "".join(list(reversed(s[-1*(len(s)//2):])))


a, b = [int(i) for i in input().split()]
print(([is_palindrome(str(n)) for n in range(a, b+1)].count(True)))

# Optimized solution
def is_palindrome(s: str) -> bool:
    return s[:len(s)//2] == s[-1*(len(s)//2):][::-1]


a, b = [int(i) for i in input().split()]
print(([is_palindrome(str(n)) for n in range(a, b+1)].count(True)))
# Original solution
a, b = list(map(int, input().split()))

cnt = 0
for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        cnt += 1

print(cnt)

# Optimized solution
a, b = list(map(int, input().split()))

lst = [1 for i in range(a, b+1) if str(i) == str(i)[::-1]]
print((sum(lst)))
# Original solution
A,B=list(map(int,input().split()))
count=0
for i in range(A,B+1):
    if list(str(i)) == list(reversed(str(i))):

        count+=1

        
print(count)


# Optimized solution
A,B=list(map(int,input().split()))
count=0
for i in range(A,B+1):
    if str(i) == ''.join(reversed(str(i))):

        count+=1

        
print(count)
# Original solution
a,b=list(map(int,input().split()))
res=0
for i in range(a,b+1):
    s=str(i)
    res += s==s[::-1]
print(res)


# Optimized solution
a,b = list(map(int,input().split()))
res = 0
for i in range(a,b+1):
    s = str(i)
    if s == s[::-1]:
        res += 1
print(res)
# Original solution
a, b = list(map(int, input().split()))

count = 0
for i in range(a, b + 1):
    listed_i = list(str(i))
    if listed_i[0] == listed_i[4] and listed_i[1] == listed_i[3]:
        count += 1

print(count)


# Optimized solution
a, b = list(map(int, input().split()))

count = 0
for i in range(a, b + 1):
    s = i // 10000
    t = (i % 10000) // 1000
    u = (i % 100) //  10
    v = i % 10
    if s == v and t == u:
        count += 1
print(count)
# Original solution
a,b = list(map(int,input().split()))
answer = 0
for i in range(a,b+1) :
    j = str(i)
    p1 = j[4]
    p2 = j[3]
    p3 = j[2]
    p4 = j[1]
    p5 = j[0]
    k = int(p1+p2+p3+p4+p5)
    if i == k :
        answer += 1
print(answer)



# Optimized solution
A,B = list(map(int,input().split()))
ans = 0
for i in range(A,B+1) :
    l = str(i)
    if l[0] == l[4] and l[1] == l[3] :
        ans += 1
print(ans)
# Original solution
A, B = list(map(int, input().split()))
count_target = 0

for i in range(A, B + 1):
    str_i = str(i)
    reversed_i = ''
    for n_th_i in reversed(list(range(len(str_i)))):
        reversed_i += str_i[n_th_i]

    if str_i == reversed_i:
        count_target += 1

print(count_target)

# Optimized solution
A, B = list(map(int, input().split()))
count_target = 0

for i in range(A, B+1):
    str_i = str(i)
    reversed_i = str_i[::-1]

    if str_i == reversed_i:
        count_target += 1

print(count_target)
# Original solution
A, B = list(map(int,input().split()))
cnt = 0
for i in range(A,B+1):
  if(list(str(i)) == list(str(i))[::-1]):
    cnt += 1
print(cnt)

# Optimized solution
A, B = list(map(int,input().split()))

cnt = 0
for i in range(A, B+1):
  if(str(i) == str(i)[::-1]):
    cnt += 1
print(cnt)
# Original solution
a,b=list(map(int,input().split()))
ans=0
for i in range(b+1)[a:]:
  if len(str(i))%2==0:
    p=list(str(i))[:len(str(i))//2]
    q=list(reversed(list(str(i))[len(str(i))//2:]))
    if p==q:
      ans+=1
  else:
    s=list(str(i))[:len(str(i))//2+1]
    d=list(reversed(list(str(i))[len(str(i))//2:]))
    if s==d:
      ans += 1
print(ans)

# Optimized solution
a,s=list(map(int,input().split()))
ad=0
for i in range(a,s+1):
  if str(i)==str(i)[::-1]:ad+=1
print(ad)
# Original solution
a, b = list(map(int, input().split()))

ans = 0
for x in range(a,b+1):
    s = str(x)
    if s == ''.join(reversed(s)):
        ans += 1

print(ans)


# Optimized solution
a, b = list(map(int, input().split()))

ans = 0
for x in range(a,b+1):
    s = str(x)
    # if s == ''.join(reversed(s)):
    if s == s[::-1] :
        ans += 1

print(ans)
# Original solution
def palindromeQ(num):
  if num%10==num//10000:
    if (num%100)//10==(num//1000)%10:
      return(1)
    else:
      return(0)
  else:
    return(0)
ans=0
A,B=[int(s) for s in input().split()]
for i in range(A,B+1):
  ans+=palindromeQ(i)
print(ans)
  

# Optimized solution
A,B=[int(s) for s in input().split()]
a=A//100
b=B//100
def pal(num):
  return num*101-num%10-(num//100)*99
ans=b-a-1
if pal(a)>=A:
  ans+=1
if pal(b)<=B:
  ans+=1
print(ans)
# Original solution
A,B = list(map(int,input().split()))

count = 0
for i in range(A, B + 1):
    aa =str(i)
    rslt = aa[::-1]
    if aa == rslt:
        count += 1
print(count)

# Optimized solution
A,B = list(map(int,input().split()))
su = abs(A -B)
count = 0
for i in range(A, B + 1):
    aa =str(i)
    rslt = aa[::-1]
    if aa == rslt:
        count += 1
print(count)
# Original solution
# -*- coding: utf-8 -*-
A,B = list(map(int,input().split()))
a = [] # 回文数の個数を入れるリストの作成
for i in range(A,B+1):
  if str(i) == str(i)[::-1]: #回文数を発見した場合
    a.append(1) #リストaに1を追加する
  else: #iが回文数でない場合
    pass # 何もしない
  
print((sum(a))) #リスト内の1をすべて足す
    

# Optimized solution
ans = 0
A,B = list(map(int,input().split()))
for i in range(A,B+1):
        I = str(i)
        if I[0] == I[4] and I[1] == I[3]:
                        ans += 1

print(ans)
# Original solution
a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        ans += 1

print(ans)


# Optimized solution
a, b = list(map(int, input().split()))

ans = 0
for i in range(a, b + 1):
  str_i = str(i)
  if str_i == str_i[::-1]:
    ans += 1
print(ans)
# Original solution
a,b=list(map(int,input().split()))
x=0
for i in range(a,b+1):
	if str(i)[:2]==str(i)[3:5][::-1]:
		x+=1
print(x)

# Optimized solution
# 入力
A,B=list(map(int,input().split()))

c=0
for i in range(A,B+1):
  i=str(i)

  # 1桁目と5桁目が一致する
  # かつ2桁目と4桁目が一致する場合
  if i[0]==i[4] and i[1]==i[3]:
    c+=1

# 出力
print(c)