APL+WIN, 154 or (削除) 76 (削除ここまで) 72 bytes
Original. Prompts for first string followed by second. Index origin = 0:
x←⎕⋄y←⎕⋄a←⎕av[17+⍳26]⋄m←((∊⌈/26⌈ ̈(n← ̄2+ ̈⍴ ̈s)+i←a⍳↑ ̈s←x y),6)⍴' '⋄m[(↑i)+⍳↑n;0]←2↓x⋄m[↑i;1]←↑1↓x⋄m[;3]←m[;2]←(↑⍴m)↑a⋄m[∊1↓i;4]←↑1↓y⋄m[(∊1↓i)+⍳∊1↓n;5]←2↓y⋄⊖m
Try it online! Thanks to Dyalog Classic
New approach. Prompts for the two strings as a nested vector:
l←∊26+⌈/⍴ ̈s←⎕⋄⍉⌽3⊖a⍪((∊2⍴ ̈-a⍳↑ ̈⌽s)⌽1⊖⊃l↑ ̈(1⌷ ̈s),2↓ ̈⌽s)⍪a←l↑a←⎕av[17+⍳26]
Graham
- 7.8k
- 1
- 15
- 13