Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

!I!n!s!e!r!t! !i!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:

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

Answer*

Draft saved
Draft discarded
Cancel
4
  • 2
    \$\begingroup\$ Actually, I created this challenge based on this Retina built-in. \$\endgroup\$ Commented Aug 18, 2019 at 11:04
  • \$\begingroup\$ Works in QuadR too. \$\endgroup\$ Commented Aug 18, 2019 at 15:01
  • \$\begingroup\$ -1 bytes in QuadR. \$\endgroup\$ Commented Aug 18, 2019 at 15:19
  • 2
    \$\begingroup\$ @A__ Right, I forgot about that feature (If there is only one non-function line...). You may want to re-consider your check-mark. \$\endgroup\$ Commented Aug 18, 2019 at 19:02

AltStyle によって変換されたページ (->オリジナル) /