I am trying to print all combinations of a string but I couldn't figure out how to do loop for it. Code works only 2-3-4 letters wordsCode:#include<stdio.h> #include<string.h> #define a 15 int main() { char str[a]; char *ptr=str; char temp; int i,n,j,b; printf("type a word to see all combinations:\n"); scanf("%s",ptr); n=strlen(str); for (j=1; j<=n; j++) { for (i=0; i<n-1; i++) { temp=str[i]; str[i]=str[i+1]; str[i+1]=temp; printf("%s ",str); } } return0; }