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):
    tmp=str(i)
    if tmp[0]==tmp[-1] and tmp[1]==tmp[-2]:
        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)
    if num == num[::-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)[0]==str(i)[-1] and str(i)[1]==str(i)[-2]:
      cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import bisect
a, b = [int(item) for item in input().split()]
kbs = [item * 100 + int(str(item)[1])*10 + int(str(item)[0]) for item in range(100,1000)]
print(bisect.bisect_right(kbs,b) - bisect.bisect_left(kbs,a))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    s = str(i)
    if len(s) % 2 == 0:
        if s[0:len(s) / 2] == s[::-1][0:len(s) / 2]:
            ans += 1
    else:
        if s[0:((len(s) - 1) // 2)] == s[::-1][0:((len(s) - 1) // 2)]:
            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//10000==i%10 and i//1000%10==i//10%10:
    ans+=1
print(ans)

Submission status: Accepted

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

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

answer = 0

for i in range(a,b+1):
    c = list(str(i))
    d = c[:]
    d.reverse()
    if c == d:
        answer += 1

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
A, B =map(int,input().split(" "))
counter =0
for i in range(A,B+1):
  I = str(i)
  if I == I[-1::-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):
    a,b,c,d,e = i//10000,(i%10000)//1000,(i%1000)//100,(i%100)//10,i%10
    if a == e and b == d:
        cnt += 1
        
print(cnt)

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
a, b = [int(_) for _ in stdin.readline().rstrip().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:
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())
cnt = 0
for i in range(A, B+1):
    n = str(i)
    if n == n[::-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 == i[::-1]:
      count += 1
print(count)

Submission status: Accepted

Solution code:
#90
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())
count=0
for c in range(1,10):
    for d in range(0,10):
        for e in range(0,10):
            s=c*10001+d*1010+e*100
            if s in range(a,b+1):
                count+=1
print(count)

Submission status: Accepted

Solution code:
def solve(string):
    a, b = map(int, string.split())
    count = 0
    for i in range(a, b + 1):
        i = str(i)
        l = len(str(i))
        if i[:(l + 1) // 2] == i[l // 2:][::-1]:
            count += 1
    return str(count)


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

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


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

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

count = 0
for i in range(1, 10):
    for j in range(10):
        for k in range(10):
            n = int(''.join(list(map(str, [i, j, k, j, i]))))
            if n >= a:
                if n <= b:
                    #print(n)
                    count += 1
                else:
                    continue
            else:
                continue
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys


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:
def kaibun(n):
  p=list(str(n))
  for i in range(len(p)//2):
    if p[i]!=p[len(p)-i-1]:
      return 0
  return 1
a,b=map(int,input().split())
count=0
for i in range(a,b+1):
  if kaibun(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):
    s =  str(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):
    xs = []
    x = i
    while x > 0:
        xs.append(x % 10)
        x //= 10
    if xs == list(reversed(xs)):
        ans += 1

print(ans)

Submission status: Accepted

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

count = 0
for i in range(A // 10000, B // 10000 + 1):
    for j in range(0, 10):
        for k in range(0, 10):
            t = i * 10000 + j * 1000 + k * 100 + j * 10 + i
            if A <= t <= B:
                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 // 10000 == i % 10 and (i // 1000) % 10 == (i // 10) % 10:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
#90B
a,b = map(int,input().split())
answer = 0

for i in range(a,b+1):
	if str(i) == ''.join(list(reversed(str(i)))):
		answer += 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for i in range(a, b+1):
    flg = True
    s = str(i)
    for j in range(len(s)):
        if s[j] != s[-(j+1)]:
            flg = False
            break

    if flg:
        count+=1

print(count)

Submission status: Accepted

Solution code:
def is_palindromic(n: int) -> bool:
    s = str(n)
    l = len(s)
    for i in range(l//2):
        if s[i] != s[-(i+1)]:
            return False
    return True


def palindromic_numbers(A: int, B: int) -> int:
    return sum(is_palindromic(n) for n in range(A, B+1, 1))


if __name__ == "__main__":
    A, B = map(int, input().split())
    ans = palindromic_numbers(A, B)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()


a,b = IL()
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())


def is_kaibunsu(num):
    s_num = str(num)
    # 条件が6桁限定
    if s_num[0:2] == s_num[-2:][::-1]:
        return True
    else:
        return False


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for s in range(a,b+1):
	if str(s) == str(s)[::-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):
    strs = [j for j in str(i)]
    if strs[0]==strs[4] and strs[1]==strs[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):
  if(str(i) == str(i)[::-1]):
    cnt += 1
print(cnt)

Submission status: Accepted

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

def calc(n):
    if len(n) == 1:
        return True
    elif n[0] == n[-1]:
        n = n[1:-1]
        return calc(n)
    else:
        return False

count = 0

for i in range(a, b+1):
    i = str(i)
    if calc(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):
    temp1 = list(str(i))
    temp2 = list(reversed(temp1))
    if temp1 == temp2:
        count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
cnt = 0
for i in range(A, B + 1):
  x = str(i)
  j, k = 0, len(x) - 1
  while j < k:
    if x[j] != x[k]:
      break
    j += 1
    k -= 1
  if k <= j:
    cnt += 1
print(cnt)

Submission status: Accepted

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

for i in range(A,B+1):
  str0 = list(str(i))
  str1 = list(str(i))
  str1.reverse()
  if(str0 == str1):
    count += 1
    
print(count)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc090/tasks/abc090_b

import itertools
import collections
import bisect

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def iskaibun(A):
    if A[0] == A[4] and A[1] == A[3]:
        return True
    else:
        return False

x = list(map(int,input().split()))
s = x[0]
f = x[1]+1
cnt = 0
for i in range(s, f):
    if iskaibun(str(i)):
        cnt += 1
print(str(cnt))

Submission status: Accepted

Solution code:
def check(n):
    nn = [n//10**x % 10 for x in range(5)]
    return nn[0] == nn[4] and nn[1] == nn[3]


def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(A, B+1):
        if check(i):
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

count = 0
for i in range(a,b+1):
    n = list(str(i))
    n = n[::-1]
    n = int("".join(map(str,n)))
    if n == i:
        count += 1

    n = -1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc090/tasks/abc090_b
a, b = [int(x) for x in 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 = map(int, input().split())
res = 0
for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        res += 1
print(res)

Submission status: Accepted

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


main()

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[0] == str_i[4] and str_i[1] == str_i[3]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=list(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:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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


def check(n):
    s = str(n)
    for c, cr in zip(s, reversed(s)):
        if c == cr:
            continue
        else:
            return False
    return True


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

Submission status: Accepted

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))

A,B=rl()

c_a = A//100 - 100 + 1
c_b = B//100 - 100 + 1
if A > (A//100*100 + A//10000 + (A//1000-A//10000*10)*10):
    c_a += 1
if B >= (B//100*100 + B//10000 + (B//1000-B//10000*10)*10):
    c_b += 1

print(c_b-c_a)

Submission status: Accepted

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

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 == s[::-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):
    s = str(i)
    l = len(s)
    if all(s[j] == s[l-j-1] for j in range(l)):
            count += 1
print(count)

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
x = range(1,10)
y = range(10)
count = 0
for p in x:
    for q in y:
        for r in y:
            sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))
            if A <= sakasama <= B:
                count += 1
print(count)

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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, raw_input().split())

ans = 0
for x in range(A, B+1):
  if x==int(str(x)[::-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):
    l1 = i//10000
    l2 = (i//1000)%10
    r1 = i%10
    r2 = (i%100)//10

    b = l1==r1 and l2==r2
#    print((i,l1,l2,r2,r1,b))

    count += 1 if b else 0

print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
s=0
for i in range(a,b+1):
    x=list(str(i))
    y=[]
    for k in range(len(x)):
        y.append(x[-1-k])
    z=""
    for j in y:
        z+=j
    if i==int(z):
        s+=1
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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:
#090B
a,b=map(int,input().split())

ans=0

for i in range(a,b+1):
	l=[]
	r_l=[]
	temp=0#onaji
	while(i!=0):
		l.append(i%10)
		#print(l)
		i=int(i/10)
	old_l=l
	old_l=tuple(old_l)
#	print(old_l)
	l.reverse()
#	print(old_l)
	l=tuple(l)
#	print(l)
	for i in range(len(l)):
		if(l[i]!=old_l[i]):
			temp=1
			break

	if(temp==0):
		ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
l = [str(i) for i in range(a,b+1)]
count=0
for i in l:
    if i == i[::-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):
    i_str = str(i)
    length= len(i_str)
    list1 = []
    list2 = []
    for j in range(length):
        list1.append(i_str[j])
    for k in range(length):
        list2.append(i_str[-k-1])
    if list1 == list2:
        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[-1] and s[1] == s[-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):
  if(list(str(i)) == list(str(i))[::-1]):
    cnt += 1
print(cnt)

Submission status: Accepted

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

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

print( countPalindromicNum( A, B ) )

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
int_a, int_b = map(int, input().split())

count = 0
for i in range(int_a, int_b + 1):
    if i == int(str(i)[::-1]):
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int,input().strip().split(' '))
a_rev = ""
i = 0
j = 0
cnt = 0

#chk = []

for i in range(b - a + 1):
    
    
    for j in range(len(str(a))):
        a_rev = a_rev + str(a)[len(str(a)) - 1 - j]   

    if str(a_rev) == str(a):
        cnt+=1
#        chk.append(a_rev)   #test
    else:
        pass
    a+=1
    a_rev =""
    
print(cnt)
#print(chk)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())




#n = ip()                              #入力整数1つ
a,b= (int(i) for i in input().split())      #入力整数横2つ
#k,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
l = []
for x in range(10):
    for y in range(10):
        for z in range(10):
            l.append([str(z)])
            l.append([str(z),str(z)])
            l.append([str(y),str(z),str(y)])
            l.append([str(y),str(z),str(z),str(y)])
            l.append([str(x),str(y),str(z),str(y),str(x)])
clist = []

for i in range(len(l)):
    d  = l[i]
    e = ''.join(d)
    clist.append(e)
c = set(clist)
l = list(c)
s = 0
for i in range(len(l)):
    if a <= int(l[i]) and int(l[i]) <= b: s+=1
print(s)

Submission status: Accepted

Solution code:
n,m= map(int,input().split())
cnt = 0
for i in range(n,m+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())
count=0
for i in range(a,b+1):
    i=str(i)
    if i[0:2] == i[-1:-3:-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):
    s = []
    for _ in [0]*5:
        s.append(i % 10)
        i //= 10
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1
print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
""" AtCoder """

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Palindromic Numbers
import sys

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

def getAns(a, b) :
    cnt = 0
    for x in range(a, b + 1) :
        L = [0] * 5
        wkX = x
        for _ in range(0, 5) :
            L[_] = wkX % 10
            wkX = wkX // 10
        if L[0] == L[4] and L[1] == L[3] :
            cnt += 1
    return cnt

print(getAns(A, B))

Submission status: Accepted

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

res = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            cand = int(''.join([str(i), str(j), str(k), str(j), str(i)]))
            if A <= cand <= B:
                res += 1

print(res)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

cunt = 0
if not 10000 <= A <= B <= 99999:
    print(0)
    sys.exit(0)
for i in range(A,B+1):
    sita = list(str(i))
    ue = sita[::-1]

    if sita == ue:
        cunt += 1

print(cunt)

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())
n=b-a
count=0
for i in range(n+1):
    t=a+i
    c=t%10#一桁目
    d=(t%100-c)//10#二桁目
    e=(t%1000-t%100)//100
    f=(t%10000-t%1000)//1000
    g=(t%100000-t%10000)//10000
    if(c==g and d==f):
        count+=1
    else:
        continue
print(count)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
print(len([i for i in map(str,range(a,b+1)) if i==i[::-1]]))#条件を満たすとき、リストの長さを１増やす。リストの長さが回文数の数。

Submission status: Accepted

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

Submission status: Accepted

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