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

AB = list(range(A, B+1))

N = B-A+1

count = 0



for i in range(N):

  count += (1 if str(AB[i]) == str(AB[i])[::-1] else 0)



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

count = 0



for i in range(A, B+1):

  count += (1 if str(i) == str(i)[::-1] else 0)



print(count)
A, B = list(map(int, input().split()))
AB = list(range(A, B + 1))
N = B - A + 1
count = 0
for i in range(N):
    count += 1 if str(AB[i]) == str(AB[i])[::-1] else 0
print(count)

A, B = list(map(int, input().split()))
count = 0
for i in range(A, B + 1):
    count += 1 if str(i) == str(i)[::-1] else 0
print(count)

-AB = list(range(A, B + 1)) -N = B - A + 1 -for i in range(N): -    count += 1 if str(AB[i]) == str(AB[i])[::-1] else 0 +for i in range(A, B + 1): +    count += 1 if str(i) == str(i)[::-1] else 0