Not sure if It's a bug or something

Hi there! So I was solving the problem Open Hamming Distance and here’s My Submission. I don’t know why but if you try to match this with any other AC submissions, my submission matches with those. I tried to debug it but it gave me some test case where a[i]!=b[i] indices were 995 when the count of substring will become 0. But it was giving some non-zero result. I don’t know if it’s a bug but it seems like a major bug.

Codechef admins kindly reply to this discussion whether its a bug or there’s my fault