## C, 373 bytes ## g(char*y){printf("%s, ",y);}z(char*w){int i,k=-1,v=0,j=sizeof(c)/sizeof(c[0]);int m[j],b=0;for(i=0;i<j;i++){m[v++]=c[i][0]==w[strlen(w)-1]?2:1;if(u[i]==6)m[v-1]=1;if(strcmp(w,c[i]))k=i;}printf("%s",w);for(i=0;i<j;i++){if(m[i]!=1){if(v+i!=j){g(s);for(;b<j;b++){if(u[b]==6)g(c[b]);}}else printf(", ");u[i]=6;z(c[i]);u[i]=1;}else v+=-1;}if(k!=-1)u[k]=1;if(v==0)printf(" ; ");} I believe there is probably a lot more golfing I could do here so I will probably update it. De-golf char *c[9]={"cat","today","yoda","artistic","cute","ewok","kilo","to","otter"}; u[9]={-1}; char *s="attic"; g(char*y){printf("%s, ",y);} z(char*w){ int i,k=-1,v=0,j=sizeof(c)/sizeof(c[0]); int m[j],b=0; for(i=0;i<j;i++){ m[v++]=c[i][0]==w[strlen(w)-1]?i:-1; if(u[i]==6)m[v-1]=-1; if(strcmp(w,c[i]))k=i; } printf("%s",w); for(i=0;i<j;i++){ if(m[i]!=-1){ if(v+i!=j){ g(s); for(;b<j;b++){ if(u[b]==6)g(c[b]); } }else printf(", "); u[i]=6; z(c[i]); u[i]=-1; } else v+=-1; } if(k!=-1)u[k]=-1; if(v==0)printf(" ; "); } main(){ z(s); printf("\n"); return 0; }