| Bytes | Lang | Time | Link |
|---|---|---|---|
| 014 | Charcoal | 251015T113912Z | Neil |
| 029 | JavaScript ES6 | 251015T095116Z | Arnauld |
| 020 | APL+WIN | 251015T092002Z | Graham |
| 010 | Retina 0.8.2 | 251015T073333Z | Neil |
| 005 | 05AB1E | 251015T071758Z | Kevin Cr |
| 029 | Google Sheets | 251015T071551Z | doubleun |
| 015 | Uiua | 251015T052242Z | RubenVer |
Charcoal, 14 bytes
⪫✂θ⁰Lθ⊖LθI⁻Lθ²
Try it online! Link is to verbose version of code. Explanation:
θ Input string
✂ ⁰ Sliced from start
Lθ To end
⊖Lθ Skipping middle
⪫ Joined with
θ Input string
L Length
⁻ Subtract
² Literal integer `2`
I Cast to string (not needed on ATO)
Implicitly print
APL+WIN 20 bytes
Prompts for string
(↑s),(⍕¯2+⍴s),¯1↑s←⎕
Retina 0.8.2, 10 bytes
\B.+\B
$.&
Try it online! Link includes test cases. Explanation: The \Bs prevent the match from happening at the beginning or end of the word, so that the first and last letters are preserved, while the interior is replaced with its length, obtained with the . modifier.
05AB1E, 5 bytes
¦¨Dg:
Try it online or verify test cases taken from Wikipedia.
Explanation:
¦ # Remove the first letter from the (implicit) input-string
¨ # As well as its last letter
D # Duplicate this middle substring
g # Pop and push the length of this copy
: # Replace the substring with this length in the (implicit) input-string
# (after which the result is output implicitly)
Google Sheets, 29 bytes
=left(A1)&len(A1)-2&right(A1)

Uiua, 15 bytes
$"___"⊙⧻°⊂⍜⇌°˜⊂
Split off first and last character, take the length of the middle, join in a string