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

c = 0

while a <= b:

    if str(a)[::-1] == str(a):

        c += 1

    a += 1

print(c)
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)
a, b = list(map(int, input().split()))
c = 0
while a <= b:
    if str(a)[::-1] == str(a):
        c += 1
    a += 1
print(c)

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)

-while a <= b: -    if str(a)[::-1] == str(a): +for i in map(str, list(range(a, b + 1))): +    if i == i[::-1]: -    a += 1