Finding CB Numbers

My code is failing in 3 test cases. please check my code why this is failing in some cases

@Aditya9266
Try to debug for this Input:
8
86922395
correct output : 4

can you tell me the error in my code where i am making the mistake

@Aditya9266
Start checking from all the subarrays/substrings of smallest size i.e. 1 and then gradually increase the size.