I have a program which creates some combinations of strings like if I entered input abc
it gives me output as bca
cab
abc
#include<stdio.h>
#include<string.h>
int main()
{
char str[15];
int i,j,n;
printf("Enter a string");
scanf("%s",str);
n=strlen(str);
for(i=0;i<n;i++)
{
str[n]=str[0];
for(j=0;j<n;j++)
{
str[j]=str[j-1];
}
str[n]='\0';
printf("\n %s \n",str);
}
return 0;
}
But I want a program which gives me all possible combinations of a string so what are the changes I need to make?