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)

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)

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)

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)

-    if s == "".join(reversed(s)): +    # if s == ''.join(reversed(s)): +    if s == s[::-1]: