There, I fixed it (with tape)
Jelly, 13 bytes
OI’“¡ʂƁ»ṁ$€ż@
Try it online!
Explanation
OI’“¡ʂƁ»ṁ$€ż@ – Full program. Take a string as a command line argument. O – Ordinal. Get the ASCII values of each character. I’ – Get the increments (deltas), and subtract 1 from each. € – For each difference I... “¡ʂƁ»ṁ$ – Mold the compressed string "tape" according to these values. Basically extends / shortens "tape" to the necessary length. ż@ – Interleave with the input.
05AB1E, 14 12 bytes
'¡ÉIÇ¥<∍‚ζJJ
Try it online!
Explanation
'¡É # push the string "tape"
I # push input
Ç # convert to a list of character codes
¥ # calculate deltas
< # decrement
∍ # extend the string "tape" to each of these sizes
# results in an empty string for sizes smaller than zero
‚ζ # zip with input (results in a list of pairs)
JJ # join to a list of strings and then to a string
Haskell, 58 bytes
f(x:y:r)=x:take(length[x..y]-2)(cycle"TAPE")++f(y:r)
f s=s
Try it online! The function f
recurses over the string and looks at consecutive characters x
and y
. cycle"TAPE"
yields the infinite string "TAPETAPETAPE..."
. [x..y]
gets the range of characters from x
to y
inclusive, so we need to subtract two from the length. In case x
occurs later in the alphabet then y
or both are the same character, we get a negative number after subtracting, but luckily take
accepts those as well and just takes nothing.