Finding CB Numbers

5 test case is passing and the other 3 is failing.
Help me out and tell your approach too.

Hi @vivekpatel

As the length of the input can be upto 17 digits which can’t be stored in int or long long int. It has to be taken as string in the input. Then traverse the string greedily and make the number by using stoi function and check if it is cb number.

Hope it Helps.

https://ide.codingblocks.com/s/218473 even now I am not able to pass all the test case

Hi @vivekpatel

You cannot directly conert input string number to int as its the same as taking the number as int input in the first place.
First take the number into input as string. Then use two nested for loops to traverse the substrings of the string and check for each of the substring convert it to int and then If any of it is cb number then increase the count;

Hope it Helps.

Please provide the solution