How can i solve this question using strings?

i’m trying to divide a string containing numbers using an int datatype, but it shows cant divide string by int

int a[i]={2,3,5,7,11,13,17,19,23,29};
string s;
s%a[i];

this code here shows error
can you please share the right code and the logic to how i can divide a string with an integer character without getting an error?

According to the Problem the work is to find the Max CB numbers from the given number.

  • As to work on substrings of the given number, we will capture the element into the String instead of integer .
  • The number ‘n’ given is nothing to do with our approach(as we are working on String) but can be useful acoording to your approach.

Intuition :

  • Put loop on string that will give substring of every length.
  • create a function that will return true if the passed number is a CB number otherwise return false.
  • To put a check if the digit is already a part of the any other CB number, create an boolean array say, valid which store which digits till now has been a part of any other CB number.
  • Take a counter and increment if a CB number is found.
  • At the end print the count.

refer this–> https://ide.codingblocks.com/s/622050

this is my code, im getting an output of 0, but i should be getting 2 can you please tell me what is wrong in my code?

ur code is not checking all potential answers that can be possible…

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.