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



cnt = 0

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

    n_s = str(n)

    n_s_len = len(n_s)

    for i in range(n_s_len//2):

        if n_s[i] != n_s[n_s_len-i-1]:

            break

    else:

        cnt += 1



print(cnt)

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



cnt = 0

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

    n_s = str(n)

    n_s_rvs = n_s[::-1]

    if n_s == n_s_rvs:

        cnt += 1



print(cnt)

A, B = list(map(int, input().split()))
cnt = 0
for n in range(A, B + 1):
    n_s = str(n)
    n_s_len = len(n_s)
    for i in range(n_s_len // 2):
        if n_s[i] != n_s[n_s_len - i - 1]:
            break
    else:
        cnt += 1
print(cnt)

A, B = list(map(int, input().split()))
cnt = 0
for n in range(A, B + 1):
    n_s = str(n)
    n_s_rvs = n_s[::-1]
    if n_s == n_s_rvs:
        cnt += 1
print(cnt)

-    n_s_len = len(n_s) -    for i in range(n_s_len // 2): -        if n_s[i] != n_s[n_s_len - i - 1]: -            break -    else: +    n_s_rvs = n_s[::-1] +    if n_s == n_s_rvs: