Finding CB numbers

https://hack.codingblocks.com/contests/c/537/100
my code-https://ide.codingblocks.com/s/40889
I am generating subsequences and checking if they are prime/CB numbers
But the problem is when I am using stoi func, substrings, for eg- “98”, is getting converted to digits-“9”, “8”, separately and not as a single number

Pls help, thanks!

You can convert the digits to numbers by multiplying by 10 and adding next integer to it.

Or you can use stoi on complete string like “456”, instead of doing it like “4” + “5” + “6”

but i am generating a substring and then applying stoi to it, line 37 in code

I could not understand the following lines from the question -
"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. "
Pls explain
My code is this https://ide.codingblocks.com/s/43610

It basically means that there can’t be 2 CB numbers having the same substring. For Ex- In 4991, both 499 and 991 are CB numbers but 99 is common substring so you can count only 1 (499 or 991) as a CB number.

Why is this code not correct ?
https://ide.codingblocks.com/s/43627


my code is correct for all test cases except test case 2. can anyone please tell me where i m lagging?