Cb numbers problem

Getting two test cases failed

Hey @shamp@blocks please share your code through ide.codingblocks.com so that i can look into your code.

https://ide.codingblocks.com/s/185336 this is my code sir

hey @shamp@blocks your logic for solving this problem is incorrect.
It is mentioned in the question that a character in a string can only be used once. So if we want to maximize the number of cb numbers we would first find cb numbers of length 1 in the string then length 2 and so on.
so instead of looping over string like

for(int i=0;i<n;i++){
for(int j=i;j<n;j++){

loop over it like this.

for(int i = 1; i <= n; i++){
for(int j = 0; j <= n - i; j++)

The first loop setting specifies the substring, but the second loop setting specifies the size of substring and then the starting point the difference is that in the first setting the starting point remaings constant i.e i but the size changes but in second loop the size remains constant (i) but starting point changes(j)

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.