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:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

a,b = MAP()
ans = 0
for i in range(1, 10): #1桁目
    for j in range(0, 10): #2桁目
        for k in range(0, 10): #3桁目
            s = str(i) + str(j) + str(k) + str(j) + str(i)
            s = int(s)
            if a <= s <= b:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
a = input().split(" ")
start = a[0]
start = list(map(int, start))
end = a[1]
end = list(map(int, end))

if (end[0] - start[0]) != 0:
    ans = (end[0] - start[0]  - 1) * 100 + end[1] * 10 + end[2] + 1 + (9 - start[1]) * 10 + (10 - start[2])
    if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
        ans -=   1
    if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
        ans -= 1

else:
    if (end[1] - start[1]) != 0:
        ans = (end[1] - start[1] - 1)  * 10 + end[2] + (10 - start[2])
        if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
            ans -=  1
        if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
            ans -= 1
                

        
    else:
        ans = end[2] - start[2] + 1
        if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
            ans -= 1
        if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
            ans -= 1

print(ans)

Submission status: Accepted

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


    if i == list(reversed(i)):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    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)


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
for x in range(a,b+1):
    if str(x)[:2] == str(x)[4:2:-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):
    s1 = str(i)
    if s1==s1[::-1]:
        count += 1

print(count)

Submission status: Accepted

Solution code:
from sys import stdin

a, b = [int(x) for x in stdin.readline().rstrip().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())
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())
cnt = 0
for i in range(A,B+1):
    if str(i)[0] == str(i)[-1]:
        if str(i)[1] == str(i)[-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):
    i = str(i)
    if i[0] == i[-1] and i[1] == i[-2]:
        count += 1
print(count)

Submission status: Accepted

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

for i in range(A,B+1):
    t=list(str(i))
    if t[::-1][0]=="0":
        pass
    else:
        if t==t[::-1]:
            cnt+=1
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0
for i in range(A,B+1,1):
    i = str(i)
    len_i = len(i)
    tmp=0
    for j in range(len_i//2):
        if i[j]==i[-j-1]:
            tmp+=1
        else:
            break
    if tmp==len_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):
    si=list(str(i))
    cnt=0
    for j in range(len(si)//2):
        if si[j]!=si[-1-j]:
            break
        else:
            cnt+=1
    if cnt==len(si)//2:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

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

ans = 0
for i in range(a,b+1):
    if str(i) == "".join(reversed((str(i)))):
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a10 = int(''.join(list(reversed(A[0:2]))))
a34 = int(A[3:5])
if a10 < a34:
  amin = int(A[1:3]) + 1
else:
  amin = int(A[1:3])

b10 = int(''.join(list(reversed(B[0:2]))))
b34 = int(B[3:5])
if b10 <= b34:
  bmin = 100 - int(B[1:3]) - 1
else:
  bmin = 100 - int(B[1:3])

n0 = int(B[0]) - int(A[0]) + 1

print(n0 * 100 - amin - bmin)

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())

i=a
cnt=0
while i<=b:
  temp=str(i)
  if temp[0]==temp[4] and temp[1]==temp[3]:
    cnt+=1
  
  i+=1
print(cnt)

Submission status: Accepted

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

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())
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:
#ABC090

a,b = list(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())
c = 0
for i in range(a, b+1):
  s = str(i)
  t = s[4] + s[3]
  if s[0] + s[1] == t :
    c += 1
print(c)

Submission status: Accepted

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

cnt = 0
for value in range(A, B+1):
  length = len(str(value))
  #print(length)
  #print(value)
  value_back = ""
  for i in range(length):
  	value_back += str(value)[length - i -1]
  if value == int(value_back):
    cnt +=1
  #print(int(value_back))

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

def is_palindromic(n):
    s, t = n % 10, (n // 10000) % 10
    u, v = (n // 10) % 10, (n // 1000) % 10
    if s == t and u == v:
        return True
    return False

count = 0
for n in range(A, B+1):
    if is_palindromic(n):
        count += 1
print(count)

Submission status: Accepted

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

def is_palindromic(n):
    sep_idx = len(n) // 2
    if n[:sep_idx] == n[sep_idx+1:][::-1]:
        return True
    return False

count = 0
for n in range(A, B+1):
    n_str = str(n)
    if is_palindromic(n_str):
        count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int , input().split())
res = 0
for n in range(A, B+1):
    l = []
    while(n > 0):
        l.append(n%10)
        n //= 10
    if (l[0]==l[4] and l[1]==l[3]):
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A_low, B_upp = map(int, input().split())
cnt = 0

for i in range(A_low, B_upp + 1):
    str_num = str(i)

    if (str_num[0] == str_num[4] and str_num[1] == str_num[3]):
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

if a < 10000 or b > 99999:
    sys.exit(1)

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 = list(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 += 1

print(ans)

Submission status: Accepted

Solution code:
def check(s):
  return s == s[::-1]

a, b = map(int, input().split())
print(sum(check(str(v)) for v in range(a, b+1)))

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 += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
class Solution:
    def solve(self, A: int, B: int) -> int:

        answer = 0

        for n in range(A, B+1):
            if str(n) == "".join(reversed(str(n))):
                answer += 1

        return answer


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(A, B))

Submission status: Accepted

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

# 桁を反転する関数
def reverseDigits(n):
  reversed = 0
  while n > 0:
    q, mod = divmod(n, 10)
    reversed = reversed * 10 + mod
    n = q
  return reversed

counter = 0
for i in range(A, B + 1):
  if i == reverseDigits(i):
    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)%10 and (i//10)%10 == (i//1000)%10:
    ans += 1
print(ans)

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())

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 check_palindrome(i):
    a = str(i)
    return a == a[::-1]

a, b = [int(e) for e in input().split()]
count = 0
for i in range(a, b+1):
    if check_palindrome(i):
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    flag = True
    chr_i = str(i)
    re_chr_i = chr_i[::-1]
    for j in range(len(chr_i)):
        if chr_i[j]!=re_chr_i[j]:
            flag = False
            break
    if flag:
        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 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):
    i = str(i)
    if i[0] == i[4] and i[1] == 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):
  if str(i) == str(i)[::-1]:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
ans=0
a,b=map(int,input().split())
for i in range(a,b+1):
    g=str(i)
    if g==g[::-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):
    if str(i) == str(i)[::-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):
    d=list(str(i))
    dl=len(d)
    #print(dl)
    c=0
    for j in range(dl//2):
       # print(d[dl-1-i])
        if d[j]==d[dl-1-j]:
            c+=1
    if c==dl//2:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for _ in range(A,B+1):
  str_ = str(_)
  if str_[0] == str_[4]:
    if str_[1] == str_[3]:
      ans += 1
      
print(ans)

Submission status: Accepted

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

count = 0
for i in range(a, b + 1):
    s = str(i)
    t = list(s)
    t.reverse()
    t = ''.join(t)
    if s == t:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
for n in range(A, B+1):
    n = str(n)
    if n == n[::-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 = str(i)
    len_s = len(s)
    for j in range(int(len_s / 2)):
        if s[j] != s[len_s - j - 1] :
            break
        if j == int(len_s / 2) - 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(map(int,list(str(i))))
  if num[0]==num[4] and num[1]==num[3]:
    ans += 1


    
print(ans)

Submission status: Accepted

Solution code:
def is_palindrome(s: str) -> bool:
    return s[:len(s)//2] == s[-1*(len(s)//2):][::-1]


a, b = [int(i) for i in input().split()]
print([is_palindrome(str(n)) for n in range(a, b+1)].count(True))

Submission status: Accepted

Solution code:
# 回文かどうかを調べる関数
def is_palindrome(s: str) -> bool:
    return s[:len(s)//2] == "".join(list(reversed(s[-1*(len(s)//2):])))


a, b = [int(i) for i in input().split()]
print([is_palindrome(str(n)) for n in range(a, b+1)].count(True))

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
ans = 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]:
    ans += 1
  else:
    continue

print(ans)

Submission status: Accepted

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

result = 0
for i in range(A, B + 1):
  s = i % 10
  t = i // 10000 % 10
  u = i // 10 % 10
  v = i // 1000 % 10
  if s == t and u == v:
    result += 1
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func(X,A,B):
    count = 0
    for i in range(X,100):
        j = str(i)
        z = j[1]+j[0]
        for y in range(10):
            tmp = int(str(i)+str(y)+z)
            if A <= tmp and tmp <= B:
                count += 1
            elif tmp > B:
                return count
    return count
a,b = input().split()
x = a[:2]
A = int(a)
B = int(b)
X = int(x)
print(func(X,A,B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def check(num):
    n=num
    digit_list=[]
    
    while num != 0:
        digit_list += [num % 10]
        num //= 10
    
    for i in range( len(digit_list) // 2 + 1*(len(digit_list)%2) ):
        if digit_list[i] != digit_list[len(digit_list)-1-i]:
            return False
    
    return True

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

count=0
for i in range(a,b+1):
    if check(i):
        count += 1

print(count)

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[0] == s[-1]) and (s[1] == s[-2]):
        ans += 1
print(ans)

Submission status: Accepted

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

def make(n):
    S=str(n)
    n2=int(S[::-1])
    return n2

ans=0
for i in range(A,B+1):
    if i==make(i):
        ans+=1
    
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    a, b = map(int, input().split())
    ans = 0
    for n in range(a, b+1):
        if list(str(n)) == list(reversed(str(n))):
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def kaibun(num) :
    num_str = str(num)
    for i in range((len(num_str)+1)//2) :
        if num_str[i] != num_str[-(i+1)] :
            return False
    return True

ans = 0

for i in range(A,B+1) :
    if kaibun(i) == True :
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
[A, B] = list(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:
A, B = [int(x) for x in input().split(" ")]

cnt = 0

for i in range(A,B+1):
    lis = list(str(i))
    for j in range(0,len(lis)):
        if j == len(lis)-1:
            cnt += 1
        elif lis[j] != lis[(-1-j)]:
            break
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

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

print(answer)

Submission status: Accepted

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

def is_pali(s):
    if s==s[::-1]: return True
    else: return False
  
  
cnt=0  
for i in range(a,b+1):
    if is_pali(str(i))==True: cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
def main():
    lower_limit, upper_limit = map(int, input().split(" "))
    answer = 0
    for i in range(lower_limit, upper_limit + 1):
        num = str(i)
        if num[0] == num[-1] and num[1] == num[-2] and num[2] == num[-3]:
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
try:
    A, B = map(int, input().split())
    B_ = [i for i in range(B+1)] 
    A_ = [j for j in range(A)]
    res = list(set(B_)-set(A_))
    cnt = 0
    for re in res:
        if str(re) == str(re)[::-1]:
            cnt += 1
    print(cnt)
except EOFError:
    pass

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
cnt=0
for i in range(a,b+1):
	if all(str(i)[j]==str(i)[-1-j] for j in range(len(str(i))//2)):
		cnt += 1
	else:
		pass
print(cnt)

Submission status: Accepted

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

cnt = 0
for i in range(a, b + 1):
    fl = 0
    s = str(i)
    for j in range(len(s)//2):
        if not s[j] == s[len(s)-1-j]:
            fl = 1
            break
    if fl == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for num in range(A,B+1,1):
    target = str(num)
    index, _ = divmod(len(target),2)
    count = 0
#     print(index)
    for i in range(index):
        if target[i] == target[-i-1]:
            count += 1
            if count == index:
                ans += 1
#                 print(target)
print(ans)

Submission status: Accepted

Solution code:
s, t = map(int, raw_input().split())
ans = 0
for a in range(s, t + 1):
    a = str(a)
    flag = 0
    for i in range(len(a)):
        if a[i] != a[len(a) - 1 - i]:
            flag = 1
            break
    if flag == 0:
        ans += 1
print ans

Submission status: Accepted

Solution code:
def count(n):
	N = []
	while n > 0:
		N.append(n % 10)
		n = n // 10

	if N[0] == N[4] and N[1] == N[3]:
		return 1
	else:
		return 0

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

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


print(int(ans))

Submission status: Accepted

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

ans = 0
for i in range(a, b + 1):
  for j in range(len(str(i))):
    if str(i)[j] != str(i)[(-1) * j - 1]:
      break
  else:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=0
for x in range(1,10):
    for y in range(0,10):
        for z in range(0,10):
            i=10000*x+1000*y+100*z+10*y+x
            if a<=i<=b:
                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)[::-1] == str(i):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
    si = str(i)
    if si[0] == si[4] and si[1] == si[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[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):
    if str(i)[0] == str(i)[4] and str(i)[1] == str(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):
  s = list(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):
    digit_1 = i % 10
    digit_2 = (i % 100)//10
    digit_4 = (i % 10000)//1000
    digit_5 = i//10000
    if digit_1 == digit_5 and digit_2 == digit_4:
        ans += 1
        #print(i)
print(ans)

Submission status: Accepted

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

ans=0

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

print(ans)

Submission status: Accepted

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

ans=0

for i in range(a,b+1):
    buf=str(i)
    #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])
    str1=buf[0:int(len(buf)/2)]
    str2=buf[int(len(buf)/2+1):]
    if str1[0]==str2[1] and str1[1]==str2[0]:
        ans+=1

print(ans)

Submission status: Accepted

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

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[-1])and(i[1]==i[-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):
    y = str(i)
    x = y[::-1]
    if y == x:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    ct=0
    for i in range(a,b+1):
        s=str(i)
        if s[0]==s[4] and s[1]==s[3]:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Palindromic Numbers
A, B = map(int,input().split())
k = B - A + 1
n = 0
for i in range(k):
    if str(A+i)[0] == str(A+i)[4] and str(A+i)[1] == str(A+i)[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):
    s = str(i)
    t = ""
    for j in range(len(s)):
        t += s[len(s)-1-j]
    if s==t:
        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 = list(str(i))
    if n[0] == n[-1] and n[1] == n[-2]:
        count += 1
print(count)

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:
# coding: utf-8
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):
    s = str(i)
    if s[0] == s[4]:
        if s[1] == s[3]:
            ans += 1
print(ans)