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(int,input().split())
ans = 0
for i in range(a,b+1):
    x = [j for j in str(i)]
    y = list(x) 
    x.reverse()
    if x == y:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
no_count = 0 
if int(str(a // 1000)[::-1]) < a % 100:
        no_count -= 1
if int(str(b // 1000)[::-1]) > b % 100:
        no_count -= 1
print(b // 100 - a // 100 + 1 + no_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())
ans = []

for i in range(A,B+1):
    l = str(i)

    if l == l[::-1] :
        ans.append(i)

print(len(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##### 解けた #####

A,B=list(map(int,input().split(" ")))
c=0 # 個数

for n in range(A,B+1):
    ns=list(str(n)) # 順に読んだ文字列
    nsr=list(reversed(ns)) # 逆順に読んだ文字列

    if ns==nsr: # もし順に読んでも逆順に読んでも同じなら
        c+=1 # 個数をインクリメント

print(c)

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 = 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:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Submission status: Accepted

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

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

print(count)

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[4] and S[1]==S[3]:
    count+=1
print(count)

Submission status: Accepted

Solution code:
def examB():
    A, B = LI()
    ans = 0
    for i in range(A,B+1):
        cur = str(i)
        if cur==cur[::-1]:
            ans +=1
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for i in range(a,b+1):
	#print(i)
	
	s = str(i)
	k = len(s)
	s1 = s[:k//2]
	s2 = s[k//2+1:]
	s3 = s2[::-1]
	#print(s1)
	#print(s2)
	#print(s3)
	if s1==s3:
		ans = ans + 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import numpy as np
import math

a,b = [int(x) for x in stdin.readline().rstrip().split()]
point = 0
for i in range(a,b+1):
    if str(i)[:2] == str(i)[3:][::-1]:
        point += 1

print(point)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
count = 0
for num in range(A, B+1):
    num = str(num)
    search_range = len(num)//2+len(num)%2
    for num_i in range(search_range):
#         print(num[num_i], num[(-1)*num_i - 1])
        if num[num_i] != num[(-1)*num_i - 1]:
            break
        if num_i == search_range -1:
            count += 1
print(count)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
import copy
M=0
for i in range(A,B+1):
    a=list(str(i))
    b=copy.deepcopy(a)
    b.reverse()
    if a==b:
        M+=1
print(M)

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 = list(map(int, input().split()))

ans = 0
for num in range(a, b+1):
    s = str(num)
    rev_s = ""
    for i in reversed(range(len(s))):
        rev_s += s[i]
    if s == rev_s:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
  A, B = map(lambda i: int(i), input().split(' '))
  count = 0
  for i in range(A, B + 1):
    nums = list(str(i))
    if nums[0] == nums[4] and nums[1] == nums[3]:
      count += 1
  print(count)

main()

Submission status: Accepted

Solution code:
#  ABC 090: B – Palindromic Numbers
a, b = [int(s) for s in input().split()]
number_of_parindromics = 0

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

print(number_of_parindromics)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
i = a[0]
m = 0
while i <= a[1]:
	n1 = i % 10
	n2 = (i % 100) // 10
	n3 = (i % 1000) // 100
	n4 = (i % 10000) // 1000
	n5 = i // 10000
	if n1 == n5 and n2 == n4:
		m += 1
	i += 1
print(m)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

main()

Submission status: Accepted

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

def check(x):
  tx = list(str(x))
  c = 1
  for i in range(len(tx)):
    if tx[i] != tx[-1 * i -1]:
      c = 0
  return c

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(counter)

Submission status: Accepted

Solution code:
number = []
number = input().split()

start_number = int(number[0])
end_number = int(number[1])
count = 0

while start_number <= end_number:
    l = []
    for s in str(start_number):
        l.append(s)
    if l[0] == l[4] and l[1] == l[3]:
        count += 1
    start_number += 1

print(count)

Submission status: Accepted

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

for i in range(10):
    for j in range(10):
        for k in range(10):
            c = 10000*i+1000*j+100*k+10*j+i
            if a <= c <= b:
                cnt += 1

print(cnt)

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[-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):
    l=list(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())
B+=1
ans=0
for i in range(A,B):
    s=str(i)
    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):
        if str(i)==str(i)[::-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 i == int(str(i)[::-1]):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b = inpl()
res = 0
for i in range(a,b+1):
    tmp = str(i)
    if tmp[0] == tmp[-1] and tmp[1] == tmp[-2]:
        res += 1
print(res)

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:
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

def main():
    def cnt(x):
        res = 0
        for i in range(9999, x + 1):
            s = str(i)
            for c0, c1 in zip(s, s[::-1]):
                if c0 != c1: break
            else:
                res += 1
        return res

    a, b = map(int, input().split())
    print(cnt(b) - cnt(a - 1))

main()

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-06 21:30:22(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    a, b = (int(x) for x in sys.stdin.read().split())

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

    print(count)       

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
result=0
for i in range(a,b+1):
    c=i
    d=list(str(i))
    d.reverse()
    if d==list(str(i)):
        result +=1
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0
for num in range(A, B+1):
  target = str(num)
  target_list = list(target)
  target_list_reversed = reversed(target_list)
  target_list_reversed = list(target_list_reversed)
  
  if target_list == target_list_reversed:
    count = count + 1
print(count)

Submission status: Accepted

Solution code:
A, B = [int(i) for i in input().split()]
bag=[]
for i in range(A, B+1):
    aa = str(i)
    if aa ==aa[::-1] :
        bag.append(i)

print(len(bag))

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
j=0
for i in range(m,n+1):
    c=int(i/10000)
    d=int(i/1000%10)
    e=int(i/100%10)
    f=int(i/10%10)
    g=int(i%10)
    if((c+d*10+e*100+f*1000+g*10000)==i):
        j+=1
print("%d"% j)

Submission status: Accepted

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

a=int(a)

b=int(b)

num=0

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

    num1=str(i)

    num2=num1[::-1]

    if num1==num2:
 
        num=num+1

print(num)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
def isP(number):
    s = str(number)
    length = len(s)
    for i in range(int(length / 2)):
        if s[i] != s[length-i-1]:
            return False
    return True

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

Submission status: Accepted

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

print(ans)

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 = 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())
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:
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):
    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):
  if str(i) == ''.join([s for s in str(i)[::-1]]): 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 = i % 10
    t = int(i / 10000) % 10
    u = int(i / 10) % 10
    v = int(i / 1000) % 10
    if s == t and u == v:
        c += 1

print(c)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	f,t = list(map(int,input().split()))

	cnt = 0
	for s in range(f,t+1):
		if str(s) == str(s)[::-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):
  o=str(i)
  l="".join(list(reversed(o)))
  if o==l:
    count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

count = 0
for i in range(A, B+1):
  if isPalindrome(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):
    t_list = list(str(i))
    if t_list[0] == t_list[4] and t_list[1] == t_list[3]:
        count += 1
print(count)

Submission status: Accepted

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

ans = 0
tmp = ''

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

print(ans)

Submission status: Accepted

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

cnt = 0
for var in range(int(a),int(b)+1):
	if str(var) == str(var)[::-1]:
		cnt = cnt + 1
	else:
		pass
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = (int(x) for x in 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):
    i = str(i)
    flg = True
    
    for j in range(int(len(i)/2)+1):    
        if i[j] == i[-j-1]:
            pass
        else:
            flg = False
    if flg:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
def check(arr):
  for j in range(len(arr) // 2):
    if(num[j] != num[len(arr) - 1 - j]):
      return False
  return True

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

cnt = 0
for i in range(a, b+1):
  num = list(map(int, list(str(i))))
  if(check(num)):
    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

    if str_i == reversed_i:
        count_target += 1

print(count_target)

Submission status: Accepted

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

for i in range(A, B + 1):
    str_i = str(i)
    reversed_i = ''
    for n_th_i in reversed(range(len(str_i))):
        reversed_i += str_i[n_th_i]

    if str_i == reversed_i:
        count_target += 1

print(count_target)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_one = input().split()
i = int(input_one[0])
two = input_one[1]
count = 0

#i = int(one)

while  i <= int(two):
    
    i = str(i)
    if i[0] == i[4]:
        if i[1] == i[3]:
            count += 1

    i = int(i) + 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def issymmetry(S):
    sym = 1
    N = len(S)
    if N%2 == 0:
        for i in range(0,N//2-1):
            if S[N//2+i] != S[N//2-1-i]:
                sym = 0
                break
    else:
        for i in range(0,N//2+1):
            if S[N//2-i] != S[N//2+i]:
                sym = 0
                break
    return(sym)

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

ans=0
for i in range(A,B+1):
    if issymmetry(str(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):
    check_str = str(i)
    if check_str == check_str[::-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 i == int(str(i)[::-1]):cnt += 1
print(cnt)

Submission status: Accepted

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

total = 0
for i in range(A,B+1):
  if i >= A and i <= B:
    if str(i) == "".join(reversed(str(i))):
      total += 1
print(total)

Submission status: Accepted

Solution code:
a,b=map(lambda x: int(x), 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:
#2019/10/22
A,B = map(int, open(0).read().split())
# print(A,B)
cnt=0
for num in range(A,B+1):
    if (str(num) == str(num)[::-1]):
        cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = list(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:
# B - Palindromic Numbers
A,B = list(map(int, input().split()))
count = 0
for i in range(A,B+1):
    C = str(i)
    if C[0] == C[4] and C[1] == C[3]:
        count += 1
    else:
        pass
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)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
        counter += 1
print(counter)

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())
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=input().split()
c=int(a[:3]+a[1]+a[0])
if int(a)>c:
  x=c//100+1
else:
  x=c//100
d=int(b[:3]+b[1]+b[0])
if int(b)<d:
  y=d//100-1
else:
  y=d//100
print(y-x+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

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):
    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())
ans = 0
for x in range(a, b + 1):
    str_x = str(x)
    if str_x == str_x[::-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)
    s_reversed = s[::-1]
    if s == s_reversed:
        ans += 1
        
print(ans)

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

Submission status: Accepted

Solution code:
def func(num):
    ws=0
    while num>0:
        qa=num%10
        ws=ws*10+qa
        num = num//10
    return ws
a,b=map(int,input().split())
print(sum(i==func(i) for i in range(a,b+1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,Z = map(str, input().split())
a=[str(x) for x in A]
z=[str(x) for x in Z]
aa =int(a[0]+a[1]+a[2])
aaa =int(a[0]+a[1]+a[2]+a[1]+a[0])
zz =int(z[0]+z[1]+z[2])
zzz =int(z[0]+z[1]+z[2]+z[1]+z[0])
gap = (zz-aa)+1
cnt = 0
if aaa<int(A):
    cnt-=1
if zzz>int(Z):
    cnt-=1
print(gap+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())
ans = 0


def kaibun(x):

    half = len(x) // 2
    front = x[:half][::-1]
    back = x[half+1:]

    if front == back:
        return True

    else:
        return False


for i in range(A, B+1):
    list_i = list(str(i))
    func = kaibun(list_i)

    if func:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def batch_number(num):
    return num == int(''.join(reversed(list(str(num)))))

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

Submission status: Accepted

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

def reverseDigits(n):
    l = []
    r = 0
    j = 0
    while(n > 0):
        l.append(n % 10)
        n //= 10
    for i in l[::-1]:
        r += i * (10 ** j)
        j += 1
    return r

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

Submission status: Accepted

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

cnt = 0
for i in range(A, B+1):
    i_str = str(i)
    if i_str[0] == i_str[4] and i_str[1] == i_str[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):
    x = str(i)
    if x[0]==x[4] and x[1]==x[3]:
        cnt += 1
print(cnt)

Submission status: Accepted

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

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[0:len(_i)//2]==list(reversed(_i))[0:len(_i)//2]:
        ans += 1
print(ans)

Submission status: Accepted

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

for num in range(a, b+1):
    s = list(str(num))
    s_num = len(s)
    t = []
    for i in range(1, s_num+1):
        x = str(s[-i])
        t.append(x)
    if s == t:
        sum += 1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

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())
count=0
for i in range(A,B+1):
    if str(i) == ''.join(reversed(str(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):
    if list(str(i)) == list(reversed(str(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):
    if str(i) == str(i)[::-1]:

        count+=1

        
print(count)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(a, b + 1):
        s = str(i)
        b = True
        for j in range(len(s)):
            if s[j] != s[-j-1]:
                b = False
                break
        if b:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

ans=0
for i in range(a,b+1):
    if i//10000 == i%10:
        
        if (i//1000)%10 == (i%100)//10:
            ans +=1
            
print(ans)