Skip to main content
added 417 characters in body
Source Link
Magic Octopus Urn
  • 20.9k
  • 6
  • 66
  • 140

05AB1E, 3132 31 23 bytes

.•2Bãθ(•×£R„vr…v•VvÈ©•¹∍¬„ rv:ð«η¤S)ζJ.∞Rηε¬ý}.c 

Try it online!Try it online!

-1 thanks to Kevin Cruijssen and -8 thanks to Adnan

Explanation (Stack example w/ input of 3):

.•2Bãθ(••VvÈ©•  # Push 'aibgyor'  | ['aibgyor'] ¹∍  # PushExtend 'vibgyor'to input length. | ['aib'] ×£ ¬ # Push head. # Dupllicate string N times-- take first N chars. | ['aib','a'] R„ v:  # Replace with ' v'.  | [' vib']  R  # Reverse.   „vr…v r: | ['biv ']  # Replace 'vr' with 'v r' η # Prefixes.   | ['b', 'bi', ð«'biv', 'biv ']  # Pad a space onto the endε } # For each.  ... | []  η  Â¬ý  # PrefixesBifurcate, join by head. | ['b','b'] -> ['bbb'] ¤ # Tail (largest prefix). | ['bi','ib'] -> ['biiib'] S)ζ # Transpose the tail onto the prefixes. | ['biv','vib'] -> ['bivvvib'] J.∞.c # Join, Mirror | ['biv ',' vib'] -> ['biv vib']  .c # Center the result. | Expected output. 

05AB1E, 31 bytes

.•2Bãθ(•×£R„vr…v r:ð«η¤S)ζJ.∞.c 

Try it online!

-1 thanks to Kevin Cruijssen

.•2Bãθ(• # Push 'vibgyor'. ×£ # Dupllicate string N times-- take first N chars. R # Reverse.   „vr…v r: # Replace 'vr' with 'v r'.   ð« # Pad a space onto the end.   η # Prefixes. ¤ # Tail (largest prefix). S)ζ # Transpose the tail onto the prefixes. J.∞.c # Join, Mirror, Center 

05AB1E, 32 31 23 bytes

.•VvÈ©•¹∍¬„ v:Rηε¬ý}.c 

Try it online!

-1 thanks to Kevin Cruijssen and -8 thanks to Adnan

Explanation (Stack example w/ input of 3):

.•VvÈ©•  # Push 'aibgyor'  | ['aibgyor'] ¹∍  # Extend to input length. | ['aib']  ¬ # Push head.  | ['aib','a'] „ v:  # Replace with ' v'.  | [' vib']  R  # Reverse. | ['biv ']   η # Prefixes. | ['b', 'bi', 'biv', 'biv ']  ε } # For each.... | []    ¬ý  # Bifurcate, join by head. | ['b','b'] -> ['bbb']  | ['bi','ib'] -> ['biiib']  | ['biv','vib'] -> ['bivvvib']  | ['biv ',' vib'] -> ['biv vib']  .c # Center the result. | Expected output. 
added 622 characters in body
Source Link
Magic Octopus Urn
  • 20.9k
  • 6
  • 66
  • 140

05AB1E, 3231 bytes

"vibgyor"×£R„vr…v.•2Bãθ(•×£R„vr…v r:ð«η¤S)ζJ.∞.c 

Try it online!Try it online!

-1 thanks to Kevin Cruijssen


.•2Bãθ(• # Push 'vibgyor'. ×£ # Dupllicate string N times-- take first N chars. R # Reverse. „vr…v r: # Replace 'vr' with 'v r'. ð« # Pad a space onto the end. η # Prefixes. ¤ # Tail (largest prefix). S)ζ # Transpose the tail onto the prefixes. J.∞.c # Join, Mirror, Center 

05AB1E, 32 bytes

"vibgyor"×£R„vr…v r:ð«η¤S)ζJ.∞.c 

Try it online!

05AB1E, 31 bytes

.•2Bãθ(•×£R„vr…v r:ð«η¤S)ζJ.∞.c 

Try it online!

-1 thanks to Kevin Cruijssen


.•2Bãθ(• # Push 'vibgyor'. ×£ # Dupllicate string N times-- take first N chars. R # Reverse. „vr…v r: # Replace 'vr' with 'v r'. ð« # Pad a space onto the end. η # Prefixes. ¤ # Tail (largest prefix). S)ζ # Transpose the tail onto the prefixes. J.∞.c # Join, Mirror, Center 
Source Link
Magic Octopus Urn
  • 20.9k
  • 6
  • 66
  • 140

05AB1E, 32 bytes

"vibgyor"×£R„vr…v r:ð«η¤S)ζJ.∞.c 

Try it online!