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)
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)
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)

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)

+su = abs(A - B)