Skip to main content
2 of 4
deleted 2 characters in body
Ven
  • 3.5k
  • 1
  • 19
  • 24

APL (Dyalog Unicode), 74 49 bytesSBCS

{(⌽∘⍉⍵@(2/¨⍳x))⍣4(⍉(⍵,1↓⌽⍵)@x)⍣2⊢''⍴⍨2⍴1-⍨2×x←≢⍵}

Try it online!

-6 thanks to ovs

Ven
  • 3.5k
  • 1
  • 19
  • 24