Written By : MathModel
The problem is asking us to count the indices such that digit from left is equal to from the right , this can be done by brute force , You should be careful that when n=\text{size}(s) is odd then the middle digit is mirror to itself which means it'll be always counted otherwise we count the digits where
(0-based indexing)
This can be done by brute forcing the indices from 0 \rightarrow \lfloor \frac{n}{2} \rfloor and updating the answer.
If is odd then we add to the answer since middle digit is mirrored to itself.
s=input()
ans=0
for i in range(len(s)//2):
if(s[i]==s[len(s)-1-i]):
ans+=1
print(ans)Complexity .