Japt, (削除) 30 (削除ここまで) 28 bytes
Hmm ... thought this would work out much shorter.
Takes input as an array of lines, right-padded with spaces and outputs an array of lines.
p-pUÎÊ+6)cU¬èd Æ'|i|úUÎÊ+3
û
p-pUÎÊ+6)cU¬èd Æ'|i|úUÎÊ+3\nû :Implicit input of array U
p :Push
-p : "-" repeated this many times
UÎ : First element of U
Ê : Length
+6 : Plus 6
) :End push
c :Concatenate
U¬ : Join U
èd : Count the "d"s
Æ : Map the range [0,count)
'|i : Prepend a "|" with
|ú : A "|" right padded with spaces to length
UÎÊ+3 : Length of first element of U plus 3
\n :Reassign to U (saves a byte over having to close all the nested methods)
û :Centre pad each element with spaces to the length of the longest
Shaggy
- 45k
- 4
- 39
- 95