Problem in logic of Question " Find CB Number"

When I submit my code non of the test cases work. A few of them give a wrong answer while the others give a “Run Error”. Clearly something is wrong in my logic. but I can’t figure out what. Please Help!

Here is my code: https://ide.codingblocks.com/s/291782

@Yash5646 use long long instead of int since size of string is upto 17 so it will give a overflow error,
For reference
https://ide.codingblocks.com/s/293018

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.