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:
def resolve():
    allPt = []
    for i in range(1, 10):
        for j in range(10):
            for k in range(10):
                allPt.append(int(str(i) + str(j) + str(k) + str(j) + str(i)))
    A, B = [int(i) for i in input().split()]
    cnt = 0
    for i in allPt:
        if A <= i and i <= B:
            cnt += 1
    print(cnt)


resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a, b = map(int, input().split())
for i in range(a, b+1):
    num_str = str(i)
    chk = ''.join(list(reversed(num_str)))
    if num_str == chk:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def f(x):
    l = len(x)
    i = 0
    while x[i] == x[l-i-1]:
        i += 1
        if i > (l//2):
            return True
            break
    return False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B = lr()
answer = sum(str(x) == str(x)[::-1] for x in range(A, B+1))
print(answer)

Submission status: Accepted

Solution code:
a, b  = map(int, input().split())
count = 0
for i in range(b):
  temp = a + i
  if temp > b:
    break
  li = []
  ni = temp
  for p in range(4):
    li.append(ni // (10 ** (4 - p)))
    ni = ni % (10 ** (4 - p))
  li.append(ni % 10)
  if li == li[::-1]:
    count += 1
print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
n = b - a + 1
count = 0

for i in range(n):
  x = a + i
  xx = list(str(x))
  xx.reverse()
  xx = int("".join(xx))
  if x == xx:
    count += 1
    
print(count)

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 == i[-1::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b = input().split()
count = 0

anum = int(a)
bnum = int(b)

# a = list(a)
# b = list(b)


for i in range(anum,bnum+1):
    stra = str(i)
    if stra == stra[::-1]:        
        count += 1
        
print(count)

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

Submission status: Accepted

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

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

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
    else:
        pass
print(count)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def judge(k):
    n = str(k)
    return n[0] == n[4] and n[1] == n[3]

def solve(a,b):
    c = 0
    for i in range(a,b+1):
        if judge(i):
            c += 1
    return c 

def main():
    A,B = map(int,input().split())
    print(solve(A,B))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,m = map(int,input().split())

def judge (x):
    if x[0] == x[4] and x[1] == x[3]:
        return True
    else:
        return False

ans = 0
for i in range(n,m+1):
    if judge(str(i)):
        ans += 1

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
[A, B] = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
  list_str = list(str(i))
  list_str_re = list(reversed(list_str))
  if list_str == list_str_re:
    cnt += 1
  else:
    continue
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#aからｂの整数。
a,b = map(int,input().split())
count=0
for i in range(a,b+1):
    i = str(i)
    if i == i[::-1]:
        count +=1
    else :
        pass
print(count)

Submission status: Accepted

Solution code:
#

# import sys
# input=sys.stdin.readline

def main():
    A,B=map(int,input().split())
    cnt=0
    for i in range(A,B+1):
        s=str(i)
        if s==s[::-1]:
            cnt+=1
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
A,B=input().split()
a=int(A[0])*10+int(A[1])
b=int(B[0])*10+int(B[1])
d=int(A[1])*10+int(A[0])
e=int(B[1])*10+int(B[0])
count_small=0
count_large=0
if a==b:
    for i in range(0,10):
        if a*1000+d+i*100>=int(A) and b*1000+e+i*100<=int(B):
            count_small+=1
    ans=count_small
else:
    for i in range(0,10):
        if a*1000+d+i*100>=int(A):
            count_small+=1
        if b*1000+e+i*100<=int(B):
            count_large+=1
    ans=(b-a-1)*10+count_small+count_large
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[6]:


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


# In[8]:


ans = 0
for x in range(A,B+1):
    x = str(x)
    for i in range(len(x)//2):
        if x[i] != x[-(i+1)]:
            break
    else:
        ans += 1
print(ans)


# In[ ]:

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

resolve()

Submission status: Accepted

Solution code:
#ABC090-B
a,b = map(int,input().split())

def kaibun(n):
    flg = True
    for i in range(len(str(n))//2):
        if str(n)[i] != str(n)[-1-i]:
            flg = False
            break
            
    if flg:
        return True
    else:
        return False
    
cnt = 0
for i in range(a,b+1):
    if kaibun(i):
        cnt += 1
        
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[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):
    s = str(i)
    if s == s[::-1]:
        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=list(str(i))
  if S == S[::-1]:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
#PaindromicNumbers
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 i in range(A,B+1):
    if str(i) == str(i)[::-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        count = 0
        for j in range(len(str(i))):
            if str(i)[j] == str(i)[(j+1)*-1]:
                count += 1
        if count == len(str(i)):
            ans += 1
    print(ans)
resolve()

Submission status: Accepted

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

def ReverseDigits(n):
    d = str()
    for i in range(5):
        d += str(n % 10)
        n = n // 10
    return(d)

ans = 0

for i in range(A, B+1):
    if str(i) == ReverseDigits(i):
        ans += 1
    else:
        pass

print(ans)

Submission status: Accepted

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

count = 0
for i in range(a, b + 1):
    l = list(str(i))
    up = l[:(len(l) // 2)]
    if len(l) % 2 == 0:
        down = l[len(l) // 2:]
        down.reverse()
    else:
        down = l[(len(l) // 2) + 1:]
        down.reverse()
    if up == down:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

ans = 0
a,b = readInts()

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

print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for x in range(a, b+1):
    s = str(x)
    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):
  k = str(i)
  if k[0::1] == k[-1::-1]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
def is_kaibun(n):
    ns = [int(v) for v in str(n)]

    i = 0
    j = len(ns) - 1
    while i < j:
        if ns[i] != ns[j]:
            return False
        i += 1
        j -= 1

    return True


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

count = 0
for i in range(A, B + 1):
    if is_kaibun(i):
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
c = str(a)
d = str(b)
e = 0
f = 0
if int(c[0]) + int(c[1]) * 10 >= int(c[3]) * 10 + int(c[4]):
    e = a // 100
else:
    e = a // 100 + 1
if int(d[0]) + int(d[1])*10 <= int(d[3])*10 + int(d[4]):
    f = b // 100
else:
    f = b // 100 - 1
print(f-e+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
def isr(si):
    for j in range(0, len(si)//2):
        if si[j] != si[-1-j]:
            return False
    return True

c = 0
for i in range(a, b+1):
    si = str(i)
    if isr(si):
        c += 1
print(c)

Submission status: Accepted

Solution code:
def main():
    A, B = map(int, input().split())
    cnt = 0
    for i in range(A, B+1):
        s = str(i)
        t = list(s)
        t.reverse()
        if s == ''.join(t):
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(a, b + 1):
    i_s = str(i)
    if i_s[-1] == i_s[0] and i_s[-2] == i_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):
    num = list(str(i))
    if num[0] == num[4] and num[1] == num[3]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0 
for i in range(A, B+1):
    num = str(i)
    judge = 1
    for j in range(len(num) // 2):
        if num[j] != num[-j-1]:
            judge = 0
            break
    if judge:
        count += 1

print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
cnt=0
for i in range(a,b+1):
  j=str(i)
  if j[0]==j[4] and j[1]==j[3]:
    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[-1]) and (s[1] == s[-2])):
        ans += 1

print(ans)

Submission status: Accepted

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

ans = 0

for i in range(1,10):
  for j in range(0,10):
    for k in range(0,10):
      num = [str(i),str(j),str(k),str(j),str(i)]
      
      if int(''.join(num)) >= a and int(''.join(num)) <= b:
#        print(num)
        ans += 1
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = []
for i in range(1, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            L.append(i * 10000 + j * 1000 + k * 100 + j * 10 + i)
a, b = map(int, input().split())
print(sum(i in L for i in range(a, b + 1)))
# print(sum(a <= e <= b for e in L))

Submission status: Accepted

Solution code:
L = []
for i in range(1, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            L.append(i * 10000 + j * 1000 + k * 100 + j * 10 + i)
a, b = map(int, input().split())
# print(sum(i in L for i in range(a, b + 1)))
print(sum(a <= e <= b for e in L))

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):
    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
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:
def main():
    a,b = map(int, input().split())
    c = [0, 0, 0, 0, 0]
    ans = 0

    for n in range(a,b+1):
        for i in range(5):
            c[i] = n % 10
            n = n // 10

        if (c[0]==c[4]) and (c[1]==c[3]):
            ans = ans + 1
    return ans

print(main())

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
l = list(map(str, list(range(a, b + 1))))
cnt = 0
for i in l:
    if i[0] == i[-1] and i[1] == i[-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):
    if str(i)[:2] == str(i)[:2:-1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
#n=int(input())
def isLoop(s):
    if (s[0] == s[-1] and s[1] == s[-2]):
        return True
    else:
        return False
a, b = map(int, input().split())
ans=0
for i in range(a, b + 1):
    if (isLoop(str(i))):
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = (int(i) for i in input().split())
cnt = 0
for i in range(a, b+1):
    s = str(i)
    bool = True
    for j in range(len(s)//2+1):
        if not s[j] == s[len(s)-1-j]:
            bool = False
            break
    if bool:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
c=0
for i in range(A,B+1):
  d=True
  i=str(i)
  for j in range(len(i)//2):
    if i[j]!=i[-(j+1)]:
      d=False
      break
  if d==True:
    c+=1
    
print(c)

Submission status: Accepted

Solution code:
def solve(n, m):

    ans = len([i for i in range(n, m+1) if str(i)[:2] == str(i)[-1:-3:-1]])
    return ans

if __name__ == "__main__":
    n, m = [int(i) for i in input().split()]
    print(solve(n, m))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def is_palindromic(s):
    if s[0] == s[-1] and s[1] == s[-2]:
        return True
    else:
        return False


def main():
    A, B = map(int, input().split())

    ans = 0
    for i in range(A, B + 1):
        ans += 1 if is_palindromic(str(i)) else 0

    print(ans)


if __name__ == "__main__":
    main()

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[4] and i[1]==i[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):
  tmps=str(i)
  if tmps[0]==tmps[4] and tmps[1]==tmps[3]:
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
A, B = list(map(int, input().split()))
count = 0
for i in range(A, B + 1):
    str_i = str(i)
    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())
c = 0
for i in range(a, b + 1):
    s = str(i)
    for j in range((len(s) + 1 )// 2):
        if s[j] != s[- 1 - j]:
            break
    else:
        c += 1
print(c)

Submission status: Accepted

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


count = 0


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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(a, b+1):
    i_str = str(i)
    if i_str == i_str[::-1]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
ans=0
while a!=b+1:
    str1=str(a)
    if str1[0]==str1[4] and str1[1]==str1[3]:
        ans+=1
    a+=1
print(ans)

Submission status: Accepted

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

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

print(c)

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[0], c[1]) == (c[-1], c[-2]):
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(A, B+1, 1):
  s = str(i)
  a = int(s[4])
  b = int(s[3])
  c = int(s[1])
  d = int(s[0])
  
  if a==d and b==c:
    count+=1
print(count)

Submission status: Accepted

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

cnt = 0

for i in range(A,B+1):
    
    Str = str(i)
    
    if Str[0] == Str[4] and Str[1]==Str[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):
	d=int(str(i)[::-1])
	if i==d:
		c+=1
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

ans = []
for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        ans.append(i)
print(len(ans))

Submission status: Accepted

Solution code:
A,B = map(str,input().split())
cnt = 0
for i in range(int(A),int(B)+1):
    l = list(str(i))
    flag = True
    n = len(l)
    for j in range(n//2):
        if l[j] != l[n-j-1]:
            flag = False
    
    if flag:
        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 == s[::-1]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
#Palindromic Numbers
a,b = map(int, input().split())
#12345
ans1=0
ans5=0
ans2=0
ans4=0
ans3=0
n=0
for i in range(a,b+1):
    ans5=i%10
    ans4=(i//10)%10
    ans3=(i//100)%10
    ans2=(i//1000)%10
    ans1=(i//10000)%10
    if ans5 == ans1:
        if  ans4 == ans2:
            n+=1
print(n)

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==i[::-1]:
        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) == str(i)[::-1]:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    nor = str(i)
    rev = "".join(list(reversed(nor)))
    if nor == rev:
        ans += 1
print(ans)

Submission status: Accepted

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

ans = 0

for x in range(A, B + 1):
    x_1 = x % 10
    x = x // 10
    x_2 = x % 10
    x = x // 10
    x_3 = x % 10
    x = x // 10
    x_4 = x % 10
    x = x // 10
    x_5 = x % 10
    if (x_1 == x_5) and (x_2 == x_4):
        ans += 1

print(ans)