Can we have better soln and here is my soln?

#include
using namespace std;
char names_input[][10]={“prateek”, “sneha”, “deepak”, “arnav”, “shikha”, “palak”, “utkarsh”, “divyam”, “vidhi”, “sparsh”, “akku”};
char keypad[][5]={"","",“abc”,“def”,“ghi”,“jkl”,“mno”,“pqrs”,“tuv”,“wxyz”};
void generate_strings(char input[],char output[],int i,int j)
{
if(input[i]==’\0’)
{
output[j]=’\0’;
for(int l=0;l<=10;l++)
{
for(int k=0;names_input[l][k]!=’\0’;k++)
{
int m;
int temp=k;
for(m=0;output[m]!=’\0’;m++)
{
if(names_input[l][k]==output[m])
k++;
else
break;
}
if(m==j)
{
cout<<names_input[l]<<endl;
break;
}
else
k=temp;
}
}
return;
}
if(input[i]==‘0’)
generate_strings(input,output,i+1,j);
int t=input[i]-‘0’;
for(int q=0;keypad[t][q]!=’\0’;q++)
{
output[j]=keypad[t][q];
generate_strings(input,output,i+1,j+1);
}
}
int main()
{
char ch[10];
char output[10];
cin>>ch;
generate_strings(ch,output,0,0);
return 0;
}

@namangarg31 you can use the string datatype instead of char to be more space efficient but it wont make much difference

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.