def solution(start: int, end: int) -> int:
revert_int = {'0', '1', '6', '8', '9'}
num = 0
for i in range(start, end):
if set(str(i)).issubset(revert_int):
temp = ''
for c in str(i)[::-1]:
if c == '6':
temp += '9'
elif c == '9':
temp += '6'
else:
temp += c
if int(temp) == i:
num += 1
return num
assert solution(0, 10) == 3
assert solution(10, 100) == 4
assert solution(100, 1000) == 12
def solution(start: int, end: int) -> int:
dic1={'0':'0','1':'1','6':'9','8':'8','9':'6'}
count=0
for i in range(start,end+1):
list1=[]
for j in str(i):
if j in dic1.keys():
list1.append(dic1[j])
if len(list1)==len(str(i)) and ''.join(list1[::-1])==str(i):
count+=1
return count
assert solution(0, 10) == 3
assert solution(10, 100) == 4
assert solution(100, 1000) == 12
def solution(start: int, end: int) -> int:
num = 0
error_num = ['2','3','4','5','7']
for i in range(start,end):
ok = True
for w in error_num:
if w in str(i):
ok = False
break
if ok:
rever_i = str(i)[::-1].replace('6', 'a').replace('9','6').replace('a','9')
if rever_i == str(i):
num+=1
return num