Https://www.geeksforgeeks.org/recursive-solution-count-substrings-first-last-characters/

I want to print all of them

please can you correct me

#include <bits/stdc++.h>
using namespace std;

//https://www.geeksforgeeks.org/recursive-solution-count-substrings-first-last-characters/

void getRequired(char *in, int i, int j, char *out){

if(in[i]=='\0'){
    return;
}

if(out[0]==out[j-1] && j-1>=0){
    out[j]='\0';
    cout<<out<<endl;
}


for(int k=i;in[k]!='\0';k++){

    out[j] = in[k];
    getRequired(in,i+1,j+1,out);
}

}

int main(){

char in[100];
cin>>in;
char out[100];
getRequired(in,0,0,out);

}

hello @talhashamim001
check now->

let me know if anything is not clear

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.