# !I!n!s!e!r!t! !n!b!e!t!w!e!e!n!

Posted from here.

This challenge is highly "distilled" from this question. Special thanks to @Akababa!

In this task, you should insert an exclamation mark at the start of the string and after every character.

## Rules

• There will always be a non-empty-string input. The input will not contain tabs either. You can assume that the input only contain non-extended ASCII printable characters and newlines.
• The input will not contain trailing newlines as long as your language can't detect a newline.
• This is a contest; the shortest answer should win.

## Examples

• 4 newlines result in 5 newline-delimited exclamation marks. It is very hard to put this as a Markdown text, so this is stated instead.
1 2 3 4 5 6
129591 129012 129127 129582

0


Outputs

!1! !2! !3! !4! !5! !6!
!1!2!9!5!9!1! !1!2!9!0!1!2! !1!2!9!1!2!7! !1!2!9!5!8!2!
!
!0!

asd afjoK ak:e
kPrLd
fOJOE;
KFO
KFkepjgop sgpaoj   faj


Outputs

!a!s!d! !a!f!j!o!K! !a!k!:!e!
!k!P!r!L!d!
! ! ! ! !f!O!J!O!E!;!
! ! ! ! !K!F!O!
!K!F!k!e!p!j!g!o!p! !s!g!p!a!o!j! ! ! !f!a!j!


A base test case with only one character:

a


Outputs

!a!


(Auto-completion! Just kidding, there is no such thing.) Contains exclamation marks:

!!
!!
!!
!!
!!


Outputs:

!!!!!
!!!!!
!!!!!
!!!!!
!!!!!

• very similar question – Giuseppe Aug 18 '19 at 11:06
• I really don't understand the downvote - this is a clear and well written challenge. Re: being a duplicate - it's not (preceding '!' makes for a big difference), and I don't believe anyone has suggested so (no close votes). – Jonathan Allan Aug 18 '19 at 13:45
• if a language can't tell the difference between a\n and a, can we require that there are no trailing newlines? – Giuseppe Aug 18 '19 at 14:29
• Downvotes are inserted between every upvote, just like what the challege describes. – a'_' Aug 18 '19 at 14:34
• This is dead. – V. Courtois Aug 19 '19 at 7:30

# Brachylog, 10 bytes

"!"w.∋w?w⊥


Try it online!

Takes input through the output variable, and unifies the input variable with "!", printing the output.

"!"w          Print "!", which is the input variable.
.∋w       Print an element of the output variable.
?w     Print the input variable again.
⊥    Fail.


# Elvish, 32 bytes

use re;re:replace "" "!" (slurp)

Copy and paste into the Live Environment to try it out!

• Welcome to the site! Would it be possible to edit in a link to an online interpreter, such as Try it online! so that other users can verify your program? – caird coinheringaahing Aug 22 '19 at 12:04
• @cairdcoinheringaahing I added a link to the provided live environment. – kon Aug 22 '19 at 13:36

~irj!'~
@Wu<


Try it online!

# Lua, 31 bytes

print((io.read():gsub("","!")))


# C (gcc), 32 bytes

f(s){printf("!%s",s)-1&&f(s+4);}


Try it online!

# Red, 47 bytes

func[s][parse s[insert"!"any[skip insert"!"]]s]


Try it online!