Skip to main content
added 114 characters in body
Source Link
jdt
  • 5.1k
  • 1
  • 16
  • 21

C (clang), 134 132132 131 bytes

-1 byte thanks to ceilingcat!

o;*t;f(*r,a,b,s){r?t=r,s="",*t=0:0;*t|=!strcmp(a,s);for(int v=2,c=*(char*)b;v--&&c;&&c;f(0,a,b+1,o))asprintf(&o,"%s%s",v?s:&c,v?&c:s),f(0,a,b+1,o);} 

Try it online!Try it online!

C (clang), 134 132 bytes

o;*t;f(*r,a,b,s){r?t=r,s="",*t=0:0;*t|=!strcmp(a,s);for(int v=2,c=*(char*)b;v--&&c;)asprintf(&o,"%s%s",v?s:&c,v?&c:s),f(0,a,b+1,o);} 

Try it online!

C (clang), 134 132 131 bytes

-1 byte thanks to ceilingcat!

o;*t;f(*r,a,b,s){r?t=r,s="",*t=0:0;*t|=!strcmp(a,s);for(int v=2,c=*(char*)b;v--&&c;f(0,a,b+1,o))asprintf(&o,"%s%s",v?s:&c,v?&c:s);} 

Try it online!

added 16 characters in body
Source Link
jdt
  • 5.1k
  • 1
  • 16
  • 21

C (clang), 134134 132 bytes

d;*t,e;fo;*t;f(*r,a,b,qs){r?t=r,q=&es="",*t=0:0;*t|=!strcmp(a,qs);for(int v=2,c=*(char*)b;c&&vb;v--;&&c;)asprintf(&d&o,"%s%s",v?qs:&c,v?&c:qs),f(0,a,b+1,do);} 

Try it online!Try it online!

C (clang), 134 bytes

d;*t,e;f(*r,a,b,q){r?t=r,q=&e,*t=0:0;*t|=!strcmp(a,q);for(int v=2,c=*(char*)b;c&&v--;)asprintf(&d,"%s%s",v?q:&c,v?&c:q),f(0,a,b+1,d);} 

Try it online!

C (clang), 134 132 bytes

o;*t;f(*r,a,b,s){r?t=r,s="",*t=0:0;*t|=!strcmp(a,s);for(int v=2,c=*(char*)b;v--&&c;)asprintf(&o,"%s%s",v?s:&c,v?&c:s),f(0,a,b+1,o);} 

Try it online!

deleted 21 characters in body
Source Link
jdt
  • 5.1k
  • 1
  • 16
  • 21

C (clang), 146134 bytes

d;*t,c;e;fe;f(*r,a,b,q,n){r?t=r,q=&e,n=0,*t=0:0;*t|=!strcmp(a,q);for(int v=2,c=*(char*)b;c&&v--;)asprintf(&d,"%s%s",v?q:&c,v?&c:q),f(0,a,b+1,d,n+1);} 

Try it online!Try it online!

C (clang), 146 bytes

d;*t,c;e;f(*r,a,b,q,n){r?t=r,q=&e,n=0,*t=0:0;*t|=!strcmp(a,q);for(int v=2,c=*(char*)b;c&&v--;)asprintf(&d,"%s%s",v?q:&c,v?&c:q),f(0,a,b+1,d,n+1);} 

Try it online!

C (clang), 134 bytes

d;*t,e;f(*r,a,b,q){r?t=r,q=&e,*t=0:0;*t|=!strcmp(a,q);for(int v=2,c=*(char*)b;c&&v--;)asprintf(&d,"%s%s",v?q:&c,v?&c:q),f(0,a,b+1,d);} 

Try it online!

deleted 183 characters in body
Source Link
jdt
  • 5.1k
  • 1
  • 16
  • 21
Loading
Source Link
jdt
  • 5.1k
  • 1
  • 16
  • 21
Loading