Making Squared Words
Charcoal, 7 5 bytes
θ‖O↙↘
Try it online! Link is to verbose version of code. Edit: Saved 2 bytes thanks to @CarlosAlejo. Explanation:
θ Print the input string, making the top row
‖O Reflect with overlap...
↙ ... down and left, to create the left side
↘ ... down and right, to create the bottom and right sides
(Multiple directions to the Reflect command run consecutively rather than simultaneously.)
MATL, 20 16 11 bytes
otYTO6Lt&(c
Try it at MATL online!
EDIT: The code works in release 20.2.1, which predates the challenge. The link uses that release. (In 20.2.2 the code would be shorter, but it postdates the challenge).
Explanation
o % Implicitly input a string. Convert chars to ASCII codes
t % Duplicate
YT % 2-input Toeplitz matrix
O % Push 0
6L % Push predefined literal [2, -1+1j]. When used as an index, this is
% interpreted as 2:end-1 (indexing is 1-based)
t % Duplicate
&( % 4-input assignment indexing. This writes 0 at the square formed by
% rows 2:end-1 and columns 2:end-1
c % Convert to char. Char 0 is shown as space. Implicitly display
Jelly, 29 22 17 bytes
Charcoal will trounce+d this score...
J⁶ẋa0,1¦"ṚṚ;$ṖŒḌY
A monadic link taking and returning a lists of characters; or a full program printing the result.
Try it online!
How?
J⁶ẋa0,1¦"ṚṚ;$ṖŒḌY - Link: list of characters, w e.g. "whole"
⁶ - literal space character ' '
J - range(length(w)) [1,2,3,4,5]
ẋ - repeat [" "," "," "," "," "]
Ṛ - reverse w "elohw"
" - zip with:
¦ - sparse application of:
a - and (vectorises)
0,1 - to indexes: [0,1] (last and 1st) ["e","ll","o o","h h","w w"]
$ - last two links as a monad:
Ṛ - reverse ["w w","h h","o o","ll","e"]
; - concatenate ["w w","h h","o o","ll","e","e","ll","o o","h h","w w"]
Ṗ - pop (remove last entry) ["w w","h h","o o","ll","e","e","ll","o o","h h"]
ŒḌ - reconstruct matrix from diagonals ["whole","h l","o o","l h","elohw"]
Y - join with newlines "whole\nh l\no o\nl h\nelohw"
- if running as a full program implicit print