Hints for Finding CB NUMBER

Could you please give some hint for approach of question: Finding CB Number

@kunal9724kg hey kunal
read the description of the question 2-3 times for a better understanding of the question.
The description states:

Deepak and Gautam are having a discussion on a new type of number that they call Coding Blocks Number or CB Number. They use following criteria to define a CB Number.

0 and 1 are not a CB number.
2,3,5,7,11,13,17,19,23,29 are CB numbers.
Any number not divisible by the numbers in point 2( Given above) are also CB numbers.
Deepak said he loved CB numbers.Hearing it, Gautam throws a challenge to him.

Gautam will give Deepak a string of digits. Deepak’s task is to find the number of CB numbers in the string.

CB number once detected should not be sub-string or super-string of any other CB number.
Ex- In 4991, both 499 and 991 are CB numbers but you can choose either 499 or 991, not both.

Further, the CB number formed can only be a sub-string of the string.
Ex - In 481, you can not take 41 as CB number because 41 is not a sub-string of 481.

As there can be multiple solutions, Gautam asks Deepak to find the maximum number of CB >numbers that can be formed from the given string.

Deepak has to take class of Launchpad students. Help him by solving Gautam’s challenge.

Basically CB numbers are prime numbers and you have to find the maximum number of CB numbers that can be formed from the string satisfying the given conditions.

For example, for the given sample input:

81615

The answer is 2 because there are two prime numbers in 81615 i.e. 8161 and 5.

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.