Problem:


Score : 200 points

Problem Statement

Find the number of palindromic numbers among the integers between A and B (inclusive).
Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.

Constraints

10000 \leq A \leq B \leq 99999

All input values are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the number of palindromic numbers among the integers between A and B (inclusive).

Sample Input 1

11009 11332

Sample Output 1

4

There are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.

Sample Input 2

31415 92653

Sample Output 2

612



Sample input:
11009 11332


Sample output:
4

Submission status: Accepted

Solution code:
a,b=map(str,input().split())
xa=int(a)
xb=int(b)
n=xb-xa
ans=0
for i in range(n+1):
    if a[0]==a[4]and a[1]==a[3]:
        ans+=1
    xa+=1
    a=str(xa)
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for n in range(a, b+1):
    s = list(str(n))
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  s=list(str(i))
  if s[0]==s[4] and s[1]==s[3]:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
# 090
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = False
def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    return list

A,B = getIntList()
db((A,B))
cnt = 0
for i in range(A,B+1):
    x = getDigitList(i)
    #db(x)
    for j in range(len(x)//2):
        #db((j,x[j],x[-j-1]))
        if x[j]!=x[-j-1]: break
    else: cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
ans = 0
for i in range(A,B+1):
  s = str(i)
  if s[0] == s[4] and s[1] == s[3]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a ,b = map(int,input().split())
cnt = 0
for number in range(a,b+1):
    if str(number) == str(number)[::-1]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
count = 0
i = A

while(True):
  s = i % 10 #1の位(一)
  t = i // 10 % 10 #10の位(十)
  u = i // 100 % 10 #100の位(百)
  v = i // 1000 % 10 #1000の位(千)
  w = i // 10000 % 10 #10000の位(万)
  if (s==w and t==v):
    count += 1
  if B==i:
    break
  i += 1
print(count)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
count = 0
i = A
while(True):
  s = i % 10
  t = i // 10000 % 10
  u = i // 10 % 10
  v = i // 1000 % 10
  if (s==t and u==v):
    count += 1
  if B==i:
    break
  i += 1
print(count)

Submission status: Accepted

Solution code:
def check(n):
    s = str(n)
    if s == s[::-1]:
        return True
    else:
        return False

def main():
    x, y = map(int, input().split())

    ans = 0
    for i in range(x, y + 1):
        if check(i):
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
    # print(check(123))
    # print(check(12321))

Submission status: Accepted

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

c = 0
for i in range(a, b + 1):
    s = str(i)
    if s == s[::-1]:
        c += 1

print(c)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ans=0
for i in range(a,b+1):
  if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
    ans = ans+1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

ans = 0
for i in range(A, B+1):
    ss = str(i)
    if ss == ss[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
ans = 0
for i in range(A,B+1):
    r_i = int("".join(list(reversed(list(str(i))))))
    if i == r_i:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
kaibun = [i*100 + (i//10-(i//100)*10)*10+i//100 for i in range(100,1000)]
print(len([kaibun[i] for i in range(900) if A <= kaibun[i] <= B]))

Submission status: Accepted

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

c=0
for i in range(A,B+1):
	s=str(i)
	if s[0]==s[4] and s[1]==s[3]: c+=1

print(c)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
count = 0
for i in range(a, b + 1):
    if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

ans = 0
for i in range(A,B+1):
    s = str(i)
    if s == s[::-1]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

ans = 0
for i in range(A,B+1):
	
	str1 = list(str(i))
	str2 = str1[::-1]
	if str1 == str2:
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
(a, b) = map(int, input().split())

count = 0
for i in range(a, b + 1):
    str_i = str(i)
    half_size = int(len(str_i) / 2)
    is_palindromic = True
    for j in range(half_size):
        front = j
        back = -j - 1
        if str_i[front] != str_i[back]:
            is_palindromic = False
            break
    if is_palindromic:
        count += 1
print(count)

Submission status: Accepted

Solution code:
s = input().split()
sa,sb = s[0],s[1]
a,b = int(sa),int(sb)
ap = int(sa[0]+sa[1]+sa[2]+sa[1]+sa[0])
bp = int(sb[0]+sb[1]+sb[2]+sb[1]+sb[0])
da = int(a/100)
db = int(b/100)
if ap < a:
    da += 1
if b < bp:
    db -= 1

print(db-da + 1)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
d = 0
for i in range(a,b+1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        d += 1
print(d)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
ans=0
for n in range(A,B+1):
    if str(n)[0]==str(n)[-1] and str(n)[1]==str(n)[-2]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
A,B = [int(n) for n in input().split()]
# N = int(input())
# S = str(input())
# T = str(input())
ans = 0
for s in range(A,B+1):
    s = str(s)
    rs = s[::-1]
    if(s == rs):
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
    r=str(i)
    if r==r[::-1]:
        c+=1
print(c)

Submission status: Accepted

Solution code:
a,b = (int(i) for i in input().split())
ct= 0
for i in range(a,b+1):
 judge = str(i)
 if judge == judge[4]+judge[3]+judge[2]+judge[1]+judge[0]:
     ct  += 1
print(ct)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    c = str(i)
    if c == c[::-1]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    s = input().split()
    sa, sb = s[0], s[1]
    a, b = int(sa), int(sb)
    ap = int(sa[0] + sa[1] + sa[2] + sa[1] + sa[0])
    bp = int(sb[0] + sb[1] + sb[2] + sb[1] + sb[0])
    da = int(a / 100)
    db = int(b / 100)
    if ap < a:
        da += 1
    if b < bp:
        db -= 1


    print(db - da + 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
count = 0
k = B-A
for j in range(k+1):
    a = A+j
    a = str(a)
    a = list(a)
    L = len(a)
    flag = 0
    for i in range(int(L/2)):
        if a[i] == a[-i-1]:
            pass
        else:
            flag = 1
            break
    if flag == 0:
        count+=1
print(count)

Submission status: Accepted

Solution code:
a, b = (int (i) for i in input().split())
kotae = 0
for i in range(a, b+1):
    s = i % 10
    t = i /10000 % 10
    u = i / 10 % 10
    v = i / 1000 % 10
    if (int(s)==int(t) and int(u)==int(v)) :
        kotae+=1

print(kotae)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
    c = str(i)
    if c[0] == c[4] and c[1] == c[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
ans = 0
for i in range(a,b+1):
  i = str(i)
  if i[0] == i[-1] and i[1] == i[-2]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0

for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
c = 0
while A <= B:
    a = str(A)
    if a[0] == a[4] and a[1] == a[3]:
        c += 1
    A += 1
print(c)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(len([i for i in map(str,range(a,b+1)) if i==i[::-1]]))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
count=0
for i in range(a,b+1):
  i=str(i)
  if i==i[::-1]:
    count+=1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
  if(str(i) == str(i)[::-1]):
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
def isPalin(s):
    for i in range(len(s)):
        if s[i]!=s[len(s)-1-i]:
            return False
    return True

A,B = [int(i) for i in input().split()]
#s = [[int(j) for j in input().split()] for i in range(N)]

res = 0
for i in range(A,B+1):
    if isPalin(str(i)):
        res+=1
print(res)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
res = 0
for i in range(a,b+1):
    s = str(i)
    if s == s[::-1]:
        res += 1
print(res)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
res = 0
for i in range(a,b+1):
    h = str(i)
    j = h[::-1]
    if h==j:
        res += 1
print(res)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = map(int, input().split())
ans = 0
for i in range(1, 10):
    for j in range(10):
        for k in range(10):
            val = 10000*i + 1000*j + 100*k + 10*j + i
            if A <= val <= B:
                ans+=1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    i = str(i)
    if i == i[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = map(int, input().split())
ans = sum(1 for i in range(A, B+1) if str(i)==str(i)[::-1])
print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


A, B = il()
c = 0
for i in range(A, B + 1):
    s = str(i)
    if s == s[::-1]:
        c += 1
print(c)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def ii():
    return int(input())


def il():
    return list(map(int, input().split()))


A, B = il()
c = 0
for i in range(A, B + 1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        c += 1
print(c)

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())
flag = True
count = B-A+1
for i in range(A, B+1):
    for j in range(int(math.ceil(len(str(A)))/2)):
        if str(i)[j] != str(i)[-1-j]:
            count -= 1
            break
print(count)

Submission status: Accepted

Solution code:
import math

A, B = map(int, input().split())
flag = True
count = 0
for i in range(A, B+1):
    for j in range(int(math.ceil(len(str(A)))/2)):
        if str(i)[j] != str(i)[-1-j]:
            count -= 1
            break
    count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
import math

min_, max_ = [int(_) for _ in sys.stdin.readlines()[0].strip().split(' ')]

res = []
for i in range(min_, max_+1):
  target = str(i)
  flag = True
  for n in range(len(target)):
    #print('target:{}, target[n]:{}, target[-(n+1)]: {}'.format(target, target[n], target[-(n+1)]))
    if not target[n] == target[-(n+1)]:
      flag = False
  if flag:
    res.append(i)
#print(res)
print(len(res))

Submission status: Accepted

Solution code:
A,B = map(int,input().split(" "))
c = 0
for i in range(A,B+1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        c += 1
print(c)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count=0
for i in range(A, B+1):
    i = str(i)

    if(i[0] == i[4] and i[1]== i[3]):
        count+=1
print(count)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest090-B
#  TODO https://atcoder.jp/contests/abc090/tasks/abc090_b
def checkPalindrom(number):
	numberString = str(number)
	if (numberString[0] == numberString[-1]) and (numberString[1] == numberString[-2]):
		result = True
	else:
		result = False
	return result

def  countPalindrom(checkRange):
	count = 0
	for number in checkRange:
		result=checkPalindrom(number)
		if result :
			count=count+1
	answer = count
	return answer

if __name__ == '__main__':
	A,B = map(int,input().strip().split(' '))
	checkRange = range(A,B+1,1)
	solution=countPalindrom(checkRange)
	print("{}".format(solution))

Submission status: Accepted

Solution code:
k , n = map(int, input().split())
r = 0
for i in range(k,n+1):
    s = str(i)
    if s == s[::-1]:
       r+=1
print(r)

Submission status: Accepted

Solution code:
A, B = map(int, input().strip().split())

def is_palind(x):
  sx = str(x)
  if sx[0]==sx[-1] and sx[1]==sx[-2]:
    return True
  else:
    return False

c = 0
for a in range(A, B+1):
  if is_palind(a):
    c+=1

print(c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    a, b = map(int, input().split())

    counter = 0
    for num in range(a, b+1):
        line = list(str(num))
        if line == line[::-1]:
            counter += 1

    print(counter)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
ans = 0
def f(x):
    return list(str(x))
for x in range(A,B+1):
    if f(x)[0] == f(x)[4] and f(x)[1] == f(x)[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    a, b = map(int, input().split())
    res = 0
    for x in range(a, b + 1):
        s = str(x)
        if s == s[::-1]:
            res += 1
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

count = 0

for i in range(a,b+1):
    S = []
    t = i
    while t!=0:
        s = t%10
        S.append(s)
        t//=10
    if S[0]==S[4] and S[1]==S[3]:
        count += 1

print(count)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    s = str(i)
    if s == s[::-1]:
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().strip().split(" "))
count=0

for i in range(0,B-A+1):
    C=A+i
    l=[int(x) for x in list(str(C))]
    if(l[0]==l[4] and l[1]==l[3]):
        count+=1

print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A,B = map(int,input().split())
a = [] # 回文数の個数を入れるリストの作成
for i in range(A,B+1):
  if str(i) == str(i)[::-1]: #回文数を発見した場合
    a.append(1) #リストaに1を追加する
  else: #iが回文数でない場合
    pass # 何もしない
  
print(sum(a)) #リスト内の1をすべて足す

Submission status: Accepted

Solution code:
A,B = [int(i) for i in input().split()]
count = 0
for i in range(A,B+1) :
    s = str(i)

    is_ok = True
    # lenが奇数でもいいはず。真ん中は関係ないので
    for n in range(len(s) // 2) :
        if (s[n] != s[-n-1]) :
            is_ok = False
            break
    if (is_ok):
        count += 1

print(count)

Submission status: Accepted

Solution code:
def abc090_b():
    a, b = map(int, input().split())
    num = 0
    for i in range(a, b + 1):
        s = str(i)
        if s[0] == s[-1] and s[1] == s[-2]:
            num += 1
    print(num)


abc090_b()

Submission status: Accepted

Solution code:
#-*- coding: utf-8 -*-

A,B=input().split() 
cnt_print=0;
for i in range(int(A),int(B)+1):
  if (str(i)[0:2] == str(i)[4:5]+str(i)[3:4]):
    cnt_print=cnt_print+1
    
print (cnt_print)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
r = 0
for i in range(a,b+1):
    if str(i) == str(i)[::-1]:
        r += 1
print(r)

Submission status: Accepted

Solution code:
def checkPalindrome(a,b):
    count=0
    for i in range(100,1000):
        p1=str(i//10)
        p2=str(i%10)
        p3=int(p1+p2+p1[1]+p1[0])
        if b>=p3 and p3>=a:
            count+=1
    return count


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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

result = 0
for i in range(a, b + 1):
    i_str = str(i)
    idx_of_half = len(i_str) // 2
    first_half = i_str[:idx_of_half]
    if len(i_str) % 2 != 0:
        idx_of_half += 1
    second_half = i_str[idx_of_half:]

    if first_half == second_half[::-1]:
        result += 1

print(result)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
count=0
for i in range(a,b+1):
  i=str(i)
  j=-1
  k=0
  while i[k]==i[j]:
    k+=1
    j-=1
    if k==(len(i)//2)+1:
      count+=1
      break
print(count)

Submission status: Accepted

Solution code:
# Palindromic Numbers
a, b = map(int, input().split())
s = set()
for i in range(b+1)[a::]:
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        s.add(i)
print(len(s))

Submission status: Accepted

Solution code:
a,b=input().split()
count=0
for i in range(int(a),int(b)+1):
	c=str(i)
	if c[0]==c[4] and c[1]==c[3]:
		count=count+1



print(count)

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
count = 0
for i in range(a,b+1):
    if str(i)[0] + str(i)[1] == str(i)[4] + str(i)[3]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
ans=0
for i in range(a,b+1):
    a=i//10000
    b=i//1000%10
    c=i//100%10
    d=i//10%10
    e=i%10
    if a==e and b==d:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

result = 0
for i in range(a, b + 1):
    i_str = str(i)
    border = len(i_str) // 2

    first_half = i_str[:border]
    if len(i_str) % 2 != 0:
        border += 1
    second_half = i_str[border:]

    compared = second_half[::-1]
    if first_half == compared:
        result += 1

print(result)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
count = 0

for i in range(A,B+1):
    if str(i) == str(i)[::-1]:
        count += 1

print(count)

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
k = 0
for i in range(a, b+1):
  if i//10000 == i % 10 and i//1000 - (i//10000 *10) == (i%100 - i%10)/10:
    k = k + 1
print(k)

Submission status: Accepted

Solution code:
a,b=input().split()
#print(a,b)
cnt=0

for j in range(int(a),int(b)+1):
  s=''
  strj=str(j)
  for i in range(len(strj)):
    s+=strj[len(strj)-1-i]
    if strj==s:
      cnt+=1
    
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
for m in range(A, B + 1):
    m = str(m)
    n = len(m) // 2
    if m[:n] == m[::-1][:n]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = [int(_) for _ in input().split()]

result = 0
for i in range(A, B + 1):
    s = str(i)
    if s == s[::-1]:
        result += 1

print(result)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
ans=0
for n in range(a,b+1):
    s = str(n)
    if s == s[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int, input().split())
ans=0
for n in range(a,b+1):
    i = str(n)
    if i[0] == i[4] and i[1] == i[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, raw_input().split())

c = 0
for i in range(A, B + 1):
	if unicode(i) == "".join(reversed(unicode(i))):
		c += 1
print c

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]
ans = 0
for i in range(a,b + 1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
x=0
for i in range(a,b+1):
	if str(i)[:2]==str(i)[3:5][::-1]:
		x+=1
print(x)

Submission status: Accepted

Solution code:
import itertools
palindromic_numbers = [0] * 100001
for i, j, k in itertools.product(range(1, 10), range(10), range(10)):
    palindromic_numbers[i * 10000 + j * 1000 + k * 100 + j * 10 + i] = 1
A, B = [int(_) for _ in input().split()]
print(sum(palindromic_numbers[A:B + 1]))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

cnt = 0
for i in range(A, B + 1):
    if str(i) == str(i)[::-1]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())

count = 0
for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
res = 0
for n in range(A, B + 1):
  S = str(n)
  if S == S[::-1]:
    res += 1
print(res)

Submission status: Accepted

Solution code:
l = list(map(int, input().split()))

a = l[0]
b = l[1]
counter = 0

for i in range(a, b+1):
	word = str(i)
	d = len(word)

	left = word[:d//2]
	right = word[-(d//2):]
	right_r = right[::-1]
	if left == right_r:
		counter += 1
	
print(counter)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  if(i%10 == i//10000 and (i//10)%10 == (i//1000)%10):
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    if i//10000 == i%10 and i // 1000%10 == i%100//10:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
a = str(a)
b = str(b)
count = 0
c = int(a)
d = int(b)
for i in range(c, d + 1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a, b = [int(i) for i in input().split()]
n = 0
for i in range(a, b+1):
  x = list(str(i))
  y = x.copy()
  y.reverse()
  if y == x:
    n+=1
print(n)

Submission status: Accepted

Solution code:
a,b=map(str,input().split())
ans=0
for j in range(int(a),int(b)+1,1):
    i=str(j)
    x=i[0]
    y=i[1]
    z=i[3]
    w=i[4]
    if x==w and y==z:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = 0
for i in range(a, b + 1):
  x = str(i)
  y = ''.join(reversed(x))
  if x == y:
    c += 1
print(c)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0
for x in range(10):
    for y in range(10):
        for z in range(1, 10):
            num = 10000*z + 1000*y + 100*x + 10*y + z
            if a <= num and num <= b:
                ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
ans = 0
for i in range(A,B+1) :
    l = str(i)
    if l[0] == l[4] and l[1] == l[3] :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
    moji = str(i)
    if moji[0] == moji[4] and moji[1] == moji[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B+1):
    moji = str(i)
    if moji[0] == moji[4] and moji[1] == moji[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())


ANS=0
for i in range(A,B+1):
    x=str(i)
    if x[0]==x[-1] and x[1]==x[-2]:
        ANS+=1

print(ANS)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
ans = 0
for n in range(A,B+1):
    s = str(n)
    if s == s[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    a, b = [int(next_str()) for _ in range(2)]
    ans = 0

    for i in range(a, b + 1):
        ans += int(judge(i))

    print(ans)


def judge(a: int) -> bool:
    s = str(a)
    n = len(s)

    for i in range(n // 2):
        if s[i] != s[n - i - 1]:
            return False

    return True


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    a, b = [int(next_str()) for _ in range(2)]
    ans = 0

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

    print(ans)


def judge(a: int) -> bool:
    s = str(a)
    n = len(s)

    for i in range(n // 2):
        if s[i] != s[n - i - 1]:
            return False

    return True


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0

for x in range(A, B+1):
	if x//10000 == x%10 and x//1000 % 10 == x//10 % 10:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
a,b = map(int, input().split())

res=0
for i in range(a,b+1):
  l = str(i)
  if l[0]==l[4] and l[1]==l[3]:
    res=res+1
print(res)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
    x = str(i)
    if x == x[::-1]:
        c += 1
print(c)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    if (i%10==i//10000)&((i//10)%10==(i//1000)%10):
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
a,b = (int(_) for _ in input().split())

ans = 0
for i in range(a,b+1):
    il = list(str(i))
    if(il[0] == il[-1] and il[1] == il[-2]):
       ans += 1

print(ans)

Submission status: Accepted

Solution code:
a,b=map(str,input().split( ))
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int,input().split())
n = 0
for i in range(a, b+1):
    num = str(i)
    if num[0] == num[4] and num[1] == num[3]:
        n += 1
print(n)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0
for i in range(a, b + 1):
    temp = list(str(i))
    if temp[0] == temp[4] and temp[1] == temp[3]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
a,b=list(map(str,input().split()))
cnt=0
for i in range(int(a),int(b)+1):
    A=str(i)
    if A[0]==A[4] and A[1]==A[3]:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c = 0
for i in range(a,b+1):
  if str(i) == str(i)[-1::-1]:
    c += 1
print(c)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
print(len([x for x in range(a,b+1) if str(x)[:2] == str(x)[4:2:-1]]))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
AB = list(range(A, B+1))
ans = 0
for i in AB:
    if str(i) == str(i)[::-1]:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())
ans = 0

for _ in range(A, B+1):
  if str(_) == str(_)[::-1]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
a, b = [int(m) for m in input().split(" ")]

pal_sum = 0
for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        pal_sum += 1
        
print(pal_sum)

Submission status: Accepted

Solution code:
def f(i):
  return str(i)==str(i)[-1::-1]

s=input().split()
res=0
for i in range(int(s[0]),int(s[1])+1):
  if f(i):
    res+=1
print(res)

Submission status: Accepted

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

ans = 0
for n in range(a, b+1):
    n = str(n)
    if n[0] == n[-1] and n[1] == n[-2]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B = map(int, input().split())

cnt = 0
for i in range(A,B+1):
    if (str(i)[0] == str(i)[4]) and (str(i)[1] == str(i)[3]):
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

cnt = 0

for i in range(A, B+1):
    tmp = list(str(i))
    if tmp[0] == tmp[-1] and tmp[1] == tmp[-2]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    s = str(i)
    if s.find(s[::-1]) == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
s,e = map(int,input().split())
count=0

for n in range(s,e+1):
    s=str(n)
    frag=0
    for m in range(len(s)//2): 
        if s[m]!=s[-m-1]:
            frag=1
    if frag==0:
        count+=1

print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
count=0
for i in range(a,b+1):
    j=str(i)
    if j[0]==j[4] and j[1]==j[3]:
        count+=1
print(count)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
r = 0
for i in range(a, b + 1):
  if str(i) == str(i)[::-1]:
    r += 1
print(r)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
for i in range(A, B + 1):
  num = str(i)
  if (num[0] == num[-1]) and (num[1] == num[-2]):
    count += 1
print(count)

Submission status: Accepted

Solution code:
def kaibunnsuu(n):
	s = str(n)
	for i in range(len(s)//2):
		if s[i] != s[-i-1]:
			return False
	return True


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

cnt = 0
for i in range(a, b+1):
	if kaibunnsuu(i) == True:
		cnt += 1
		#print(i)
print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int,input().split()) 
c = 0
for i in range(1,10):
  for j in range(0,10):
    for k in range(0,10):
      x = 10001*i+1010*j+100*k
      if x >= a and x <= b:
        c += 1
print(c)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

ans = 0

for i in range(b - a + 1):
    n = a + i
    l = list(str(n))
    lr = list(reversed(l))

    if l == lr:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
j = 0
for i in range(A,B+1):
  l = list(str(i))
  l_reverse = list(reversed(l))
  if l == l_reverse:
    j += 1
print(j)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
num = 0
for i in range(a, b + 1):
    if (str(i) == str(i)[::-1]):
        num+=1
print(num)

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
  i = str(i)
  if i[0]==i[4] and i[1]==i[3]:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
ans = 0
for number in range(a,b+1):
    if list(str(number)) == list(str(number))[::-1]:
        ans += 1
print(ans)