#include<iostream>
using namespace std;
char str[] = "hart";
char *out;
int length;
int rec = 0;
void DoCombine(char in[],char out[],int len,int rec,int start)
{
for (int i=start;i<len;i++)
{
out[rec] = in[i];
out[rec+1] = 0;
printf("%s",out);
printf("/n");
if (i < len-1)
{
DoCombine(in,out,len,rec+1,start+1);
}
start++;
}
}
int main(void)
{
int length = strlen(str);
out = (char*) malloc (sizeof(char) * length + 1);
printf("output the substring :/n");
DoCombine(str,out,length,0,0);
return 0;
}