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

cnt = 0

for i in range(a,b+1):

  tmp = list(map(int,list(str(i))))

  if tmp==list(reversed(tmp)):

    cnt+=1

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

cnt = 0

for i in range(a,b+1):

  tmp = list(str(i))

  if tmp==list(reversed(tmp)):

    cnt+=1

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

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

-    tmp = list(map(int, list(str(i)))) +    tmp = list(str(i))