Please help it is not accepting all tc

hello @kailash_01 the mistake you are doing is that if you have counted one number as a valid cb number then that number or any substring in that number cant be the part of any other substring .
that is why you are unable to solve for all the test cases .
like see for this test case.
9
235723371
in this test case the result produce by your code is different from the expected output .
the expected output is 8 .