#The solution in Python is as follows:
i,j,k=map(int,input().split())
l=i
beauty=0
while l<=j:
a=l
b=str(a)[::-1]
c=int(b)
if (c-a)%k==0:
beauty+=1
l+=1
print(beauty)
#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!
If you want to hone your programming skills in python and improve your performance in competitive programming platforms, then this is the destination you are looking for. Happy Coding!!!