!I!n!s!e!r!t! !b!e!t!w!e!e!n!Full Width TextRandom Sentence GeneratorBreak tabs in halfAlign function arguments on their own linesMake a “Ceeeeeeee” programAccessories after the fact!Quote my quote!Carve a square from a stringSplit it. But not all!
What should I do with the stock I own if I anticipate there will be a recession?
Unsolved Problems due to Lack of Computational Power
What's the point of writing that I know will never be used or read?
Can 'in-' mean both 'in' and 'no'?
What happened after the end of the Truman Show?
Best model for precedence constraints within scheduling problem
Do predators tend to have vertical slit pupils versus horizontal for prey animals?
Why doesn't mathematics collapse down, even though humans quite often make mistakes in their proofs?
Will some rockets really collapse under their own weight?
Does the Temple of the Gods spell nullify critical hits?
Why do balloons get cold when they deflate?
Quick destruction of a helium filled airship?
Postdoc interview - somewhat positive reply but no news?
how do I go from CDG airport to Montparnasse gare quickly and cheaply?
Are there categories whose internal hom is somewhat 'exotic'?
Why should P.I be willing to write strong LOR even if that means losing a undergraduate from his/her lab?
Does git delete empty folders?
Airline power sockets shut down when I plug my computer in. How can I avoid that?
Levenshtein Neighbours
Why was ramjet fuel used as hydraulic fluid during Saturn V checkout?
What kind of (probable) traffic accident might lead to the desctruction of only (!) the brain stem and cerebellum?
Starships without computers?
How does the illumination of the sky from the sun compare to that of the moon?
How to add a table description to a longtable?
!I!n!s!e!r!t! !b!e!t!w!e!e!n!
Full Width TextRandom Sentence GeneratorBreak tabs in halfAlign function arguments on their own linesMake a “Ceeeeeeee” programAccessories after the fact!Quote my quote!Carve a square from a stringSplit it. But not all!
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
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 code-golf 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:
!!!!!
!!!!!
!!!!!
!!!!!
!!!!!
code-golf string
$endgroup$
|
show 4 more comments
$begingroup$
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 code-golf 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:
!!!!!
!!!!!
!!!!!
!!!!!
!!!!!
code-golf string
$endgroup$
3
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
2
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
3
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago
|
show 4 more comments
$begingroup$
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 code-golf 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:
!!!!!
!!!!!
!!!!!
!!!!!
!!!!!
code-golf string
$endgroup$
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 code-golf 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:
!!!!!
!!!!!
!!!!!
!!!!!
!!!!!
code-golf string
code-golf string
edited 6 hours ago
A__
asked 11 hours ago
A__A__
1,0511 silver badge16 bronze badges
1,0511 silver badge16 bronze badges
3
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
2
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
3
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago
|
show 4 more comments
3
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
2
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
3
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago
3
3
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
2
2
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
3
3
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago
|
show 4 more comments
24 Answers
24
active
oldest
votes
$begingroup$
Retina 0.8.2, 2 bytes
!
Try it online! At last, a challenge where Retina has a built-in!
$endgroup$
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
add a comment |
$begingroup$
brainfuck, 24 bytes
>-[-[-<]>>+<]>.>,[.<.>,]
Try it online!
$endgroup$
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
add a comment |
$begingroup$
Python 3, 27 bytes
lambda s:f"!'!'.join(s)!"
Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.
$endgroup$
add a comment |
$begingroup$
Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee
Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
# The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
rREeeEeeeeE # Push "!" -> (R)
# r flag inserts it instead of pushing
REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
# Removes the 0 in (R)
Reee # Output (R)
$endgroup$
add a comment |
$begingroup$
Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 6, 16 bytes
S:g/<![t]>/!/
Try it online!
Replaces all zero width matches of non-tabs (i.e. every gap between characters) with exclamation marks. There may be a shorter way of doing zero-width assertions, though null regexes are not allowed.
$endgroup$
add a comment |
$begingroup$
Haskell, 18 bytes
('!':).(>>=(:"!"))
-1 byte thanks to @nimi
Try it online!
$endgroup$
1
$begingroup$
('!':).saves a byte.
$endgroup$
– nimi
6 hours ago
add a comment |
$begingroup$
Perl 5 -p, 17 bytes
$_='!'.s,.,$&!,gr
Try it online!
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!
Try it
Not much to explain: ï is Cartesian product and i prepends.
$endgroup$
add a comment |
$begingroup$
QuadR, 1 byte
Thanks to A__ for halving the byte count!
!
Try it online!
Replaces nothing with !
$endgroup$
add a comment |
$begingroup$
JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!$s.join`!`!`
Try it online!
JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")
Try it online!
JavaScript (ES6), 23 bytes
Takes input as a string.
s=>['',...s,''].join`!`
Try it online!
$endgroup$
1
$begingroup$
Alternative with.replace, 22 bytes
$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
add a comment |
$begingroup$
Labyrinth, 19 11 10 bytes
3
3
:.
.,@
Try it online!
How?
I / O stack
0,0,0,...
3 - pop * 10 + 3 3,0,0,0,...
3 - pop * 10 + 3 33,0,0,0,...
: - duplicate 33,33,0,0,0,...
- T junction from the side
- 33 > 0 so turn*
. - pop & print chr ! 33,0,0,0,...
, - read chr or -1 L 76,33,0,0,0,...
- T junction from the base
- if TOS > 0 right:
. - pop & print chr L 33,0,0,0,...
- back to ":"
- elif TOS == -1 left:
@ - exit
* right, but on the first occasion (from above) we hit the wall and turn
around, so that's like a left
Luckily we don't need to handle un-printables, otherwise the zero-byte would turn us around at , and get output twice by .:. (with us hitting the wall at : and turning around).
$endgroup$
add a comment |
$begingroup$
Charcoal, 6 bytes
⭆S⁺!ι!
Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫S!
Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.
$endgroup$
add a comment |
$begingroup$
05AB1E, 7 bytes
Takes input as a list of characters.
'!ý'!.ø
Try it online! or Try it online! (with input as a string)
$endgroup$
add a comment |
$begingroup$
Gema, 11 characters
A=!
?=?!
Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6n129591 129012 129127 129582nn0' | gema 'A=!;?=?!'
!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!
Try it online!
$endgroup$
add a comment |
$begingroup$
Zsh, 32 bytes
for c ('' $(s::)1)echo -nE $c!
Try it online!
(s::) splits into characters, '' adds an empty element to the start, and then echo -nE $c! echoes each followed by an !.
$endgroup$
add a comment |
$begingroup$
Jelly, 5 bytes
Ż”!ṁż
A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s e.g. "abc"
”! - character '!' '!'
ṁ - mould like:
Ż - s with a zero prepended "!!!!"
ż - zip together with s ["!a","!b","!c",'!']
- implicit (smashing) print !a!b!c!
$endgroup$
add a comment |
$begingroup$
SNOBOL4 (CSNOBOL4), 94 bytes
I I =INPUT :F(END)
S I LEN(1) . X REM . I :F(O)
O ='!' O X :(S)
O OUTPUT =O '!'
O = :(I)
END
Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in n or not.
$endgroup$
add a comment |
$begingroup$
Stax, 6 5 bytes
_z'!R
Run and debug it
Replace "" with "!" using regex replacement. I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10
If there is a match with an emptystring (in other words, if the value of regexp.lastIndex is left unchanged), increment regexp.lastIndex by 1.
Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.
- If input was provided in an escaped literal e.g.
"line1nline2". But I opted against that for the sake of "usability". - If there was not a
bugfeature in stax's zip implementation when encountering empty strings/arrays.
$endgroup$
add a comment |
$begingroup$
Triangular, 15 bytes
B.3.*#).(/?~@<
Try it online!
Ungolfed:
B
. 3
. *
# ) . (
/ ? ~ @ <
----------------------------------------------------------
B3* - Push 11 and 3, then pop both and push their product
(< - Set jump position and change direction
@ - Print Top of Stack as a character without popping
~ - Push a character read from input (-1 if no input)
?/ - Skip next instruction if ToS <= 0
# - Print ToS as a character, pop ToS
) - Jump to position previously set
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
r Replace
P all empty strings "" with
'! An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)
$endgroup$
add a comment |
$begingroup$
Perl 5 + -p, 11 bytes
s/^|.K/!/g
Try it online!
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
+!s+R!
Try it online!
Code | Explanation
----------+-------------------------------------
+!s+R! | Code
+!s+R!Q | with implicit variables filled
----------+-------------------------------------
R Q | For each d in input, replace d with:
+R! | d+"!"
s | Join results on empty string
+! | Add "!" to beginning
| Print (implicit)
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!String.Join("!",s)!"
Try it online!
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f190223%2finsert-between%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
24 Answers
24
active
oldest
votes
24 Answers
24
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Retina 0.8.2, 2 bytes
!
Try it online! At last, a challenge where Retina has a built-in!
$endgroup$
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
add a comment |
$begingroup$
Retina 0.8.2, 2 bytes
!
Try it online! At last, a challenge where Retina has a built-in!
$endgroup$
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
add a comment |
$begingroup$
Retina 0.8.2, 2 bytes
!
Try it online! At last, a challenge where Retina has a built-in!
$endgroup$
Retina 0.8.2, 2 bytes
!
Try it online! At last, a challenge where Retina has a built-in!
answered 10 hours ago
NeilNeil
87.5k8 gold badges46 silver badges183 bronze badges
87.5k8 gold badges46 silver badges183 bronze badges
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
add a comment |
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Actually, I created this challenge based on this Retina built-in.
$endgroup$
– A__
10 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
Works in QuadR too.
$endgroup$
– Adám
6 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$begingroup$
-1 bytes in QuadR.
$endgroup$
– A__
5 hours ago
$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$
– Adám
2 hours ago
$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$
– Adám
2 hours ago
add a comment |
$begingroup$
brainfuck, 24 bytes
>-[-[-<]>>+<]>.>,[.<.>,]
Try it online!
$endgroup$
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
add a comment |
$begingroup$
brainfuck, 24 bytes
>-[-[-<]>>+<]>.>,[.<.>,]
Try it online!
$endgroup$
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
add a comment |
$begingroup$
brainfuck, 24 bytes
>-[-[-<]>>+<]>.>,[.<.>,]
Try it online!
$endgroup$
brainfuck, 24 bytes
>-[-[-<]>>+<]>.>,[.<.>,]
Try it online!
edited 6 hours ago
answered 6 hours ago
Krzysztof SzewczykKrzysztof Szewczyk
1,7461 gold badge4 silver badges15 bronze badges
1,7461 gold badge4 silver badges15 bronze badges
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
add a comment |
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
$begingroup$
22 bytes
$endgroup$
– Jo King
2 mins ago
add a comment |
$begingroup$
Python 3, 27 bytes
lambda s:f"!'!'.join(s)!"
Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.
$endgroup$
add a comment |
$begingroup$
Python 3, 27 bytes
lambda s:f"!'!'.join(s)!"
Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.
$endgroup$
add a comment |
$begingroup$
Python 3, 27 bytes
lambda s:f"!'!'.join(s)!"
Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.
$endgroup$
Python 3, 27 bytes
lambda s:f"!'!'.join(s)!"
Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.
answered 9 hours ago
squidsquid
4917 bronze badges
4917 bronze badges
add a comment |
add a comment |
$begingroup$
Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee
Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
# The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
rREeeEeeeeE # Push "!" -> (R)
# r flag inserts it instead of pushing
REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
# Removes the 0 in (R)
Reee # Output (R)
$endgroup$
add a comment |
$begingroup$
Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee
Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
# The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
rREeeEeeeeE # Push "!" -> (R)
# r flag inserts it instead of pushing
REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
# Removes the 0 in (R)
Reee # Output (R)
$endgroup$
add a comment |
$begingroup$
Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee
Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
# The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
rREeeEeeeeE # Push "!" -> (R)
# r flag inserts it instead of pushing
REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
# Removes the 0 in (R)
Reee # Output (R)
$endgroup$
Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee
Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
# The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
rREeeEeeeeE # Push "!" -> (R)
# r flag inserts it instead of pushing
REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
# Removes the 0 in (R)
Reee # Output (R)
edited 8 hours ago
answered 8 hours ago
u_ndefinedu_ndefined
9683 silver badges14 bronze badges
9683 silver badges14 bronze badges
add a comment |
add a comment |
$begingroup$
Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)
Try it online!
$endgroup$
Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)
Try it online!
answered 8 hours ago
Jonathan AllanJonathan Allan
58.9k5 gold badges44 silver badges185 bronze badges
58.9k5 gold badges44 silver badges185 bronze badges
add a comment |
add a comment |
$begingroup$
Perl 6, 16 bytes
S:g/<![t]>/!/
Try it online!
Replaces all zero width matches of non-tabs (i.e. every gap between characters) with exclamation marks. There may be a shorter way of doing zero-width assertions, though null regexes are not allowed.
$endgroup$
add a comment |
$begingroup$
Perl 6, 16 bytes
S:g/<![t]>/!/
Try it online!
Replaces all zero width matches of non-tabs (i.e. every gap between characters) with exclamation marks. There may be a shorter way of doing zero-width assertions, though null regexes are not allowed.
$endgroup$
add a comment |
$begingroup$
Perl 6, 16 bytes
S:g/<![t]>/!/
Try it online!
Replaces all zero width matches of non-tabs (i.e. every gap between characters) with exclamation marks. There may be a shorter way of doing zero-width assertions, though null regexes are not allowed.
$endgroup$
Perl 6, 16 bytes
S:g/<![t]>/!/
Try it online!
Replaces all zero width matches of non-tabs (i.e. every gap between characters) with exclamation marks. There may be a shorter way of doing zero-width assertions, though null regexes are not allowed.
answered 6 hours ago
Jo KingJo King
30.9k3 gold badges71 silver badges139 bronze badges
30.9k3 gold badges71 silver badges139 bronze badges
add a comment |
add a comment |
$begingroup$
Haskell, 18 bytes
('!':).(>>=(:"!"))
-1 byte thanks to @nimi
Try it online!
$endgroup$
1
$begingroup$
('!':).saves a byte.
$endgroup$
– nimi
6 hours ago
add a comment |
$begingroup$
Haskell, 18 bytes
('!':).(>>=(:"!"))
-1 byte thanks to @nimi
Try it online!
$endgroup$
1
$begingroup$
('!':).saves a byte.
$endgroup$
– nimi
6 hours ago
add a comment |
$begingroup$
Haskell, 18 bytes
('!':).(>>=(:"!"))
-1 byte thanks to @nimi
Try it online!
$endgroup$
Haskell, 18 bytes
('!':).(>>=(:"!"))
-1 byte thanks to @nimi
Try it online!
edited 5 hours ago
answered 8 hours ago
Leo TenenbaumLeo Tenenbaum
1,6232 gold badges7 silver badges17 bronze badges
1,6232 gold badges7 silver badges17 bronze badges
1
$begingroup$
('!':).saves a byte.
$endgroup$
– nimi
6 hours ago
add a comment |
1
$begingroup$
('!':).saves a byte.
$endgroup$
– nimi
6 hours ago
1
1
$begingroup$
('!':). saves a byte.$endgroup$
– nimi
6 hours ago
$begingroup$
('!':). saves a byte.$endgroup$
– nimi
6 hours ago
add a comment |
$begingroup$
Perl 5 -p, 17 bytes
$_='!'.s,.,$&!,gr
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -p, 17 bytes
$_='!'.s,.,$&!,gr
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 -p, 17 bytes
$_='!'.s,.,$&!,gr
Try it online!
$endgroup$
Perl 5 -p, 17 bytes
$_='!'.s,.,$&!,gr
Try it online!
answered 8 hours ago
Kjetil S.Kjetil S.
7272 silver badges5 bronze badges
7272 silver badges5 bronze badges
add a comment |
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!
Try it
Not much to explain: ï is Cartesian product and i prepends.
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!
Try it
Not much to explain: ï is Cartesian product and i prepends.
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!
Try it
Not much to explain: ï is Cartesian product and i prepends.
$endgroup$
Japt, 4 bytes
rP'!
Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!
Try it
Not much to explain: ï is Cartesian product and i prepends.
edited 3 hours ago
answered 10 hours ago
ShaggyShaggy
21k3 gold badges20 silver badges71 bronze badges
21k3 gold badges20 silver badges71 bronze badges
add a comment |
add a comment |
$begingroup$
QuadR, 1 byte
Thanks to A__ for halving the byte count!
!
Try it online!
Replaces nothing with !
$endgroup$
add a comment |
$begingroup$
QuadR, 1 byte
Thanks to A__ for halving the byte count!
!
Try it online!
Replaces nothing with !
$endgroup$
add a comment |
$begingroup$
QuadR, 1 byte
Thanks to A__ for halving the byte count!
!
Try it online!
Replaces nothing with !
$endgroup$
QuadR, 1 byte
Thanks to A__ for halving the byte count!
!
Try it online!
Replaces nothing with !
answered 2 hours ago
AdámAdám
29.6k2 gold badges79 silver badges212 bronze badges
29.6k2 gold badges79 silver badges212 bronze badges
add a comment |
add a comment |
$begingroup$
JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!$s.join`!`!`
Try it online!
JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")
Try it online!
JavaScript (ES6), 23 bytes
Takes input as a string.
s=>['',...s,''].join`!`
Try it online!
$endgroup$
1
$begingroup$
Alternative with.replace, 22 bytes
$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
add a comment |
$begingroup$
JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!$s.join`!`!`
Try it online!
JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")
Try it online!
JavaScript (ES6), 23 bytes
Takes input as a string.
s=>['',...s,''].join`!`
Try it online!
$endgroup$
1
$begingroup$
Alternative with.replace, 22 bytes
$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
add a comment |
$begingroup$
JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!$s.join`!`!`
Try it online!
JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")
Try it online!
JavaScript (ES6), 23 bytes
Takes input as a string.
s=>['',...s,''].join`!`
Try it online!
$endgroup$
JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!$s.join`!`!`
Try it online!
JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")
Try it online!
JavaScript (ES6), 23 bytes
Takes input as a string.
s=>['',...s,''].join`!`
Try it online!
edited 1 hour ago
answered 10 hours ago
ArnauldArnauld
90.4k7 gold badges105 silver badges369 bronze badges
90.4k7 gold badges105 silver badges369 bronze badges
1
$begingroup$
Alternative with.replace, 22 bytes
$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
add a comment |
1
$begingroup$
Alternative with.replace, 22 bytes
$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
1
1
$begingroup$
Alternative with
.replace, 22 bytes$endgroup$
– tjjfvi
2 hours ago
$begingroup$
Alternative with
.replace, 22 bytes$endgroup$
– tjjfvi
2 hours ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
$begingroup$
@tjjfvi Nifty one!
$endgroup$
– Arnauld
1 hour ago
add a comment |
$begingroup$
Labyrinth, 19 11 10 bytes
3
3
:.
.,@
Try it online!
How?
I / O stack
0,0,0,...
3 - pop * 10 + 3 3,0,0,0,...
3 - pop * 10 + 3 33,0,0,0,...
: - duplicate 33,33,0,0,0,...
- T junction from the side
- 33 > 0 so turn*
. - pop & print chr ! 33,0,0,0,...
, - read chr or -1 L 76,33,0,0,0,...
- T junction from the base
- if TOS > 0 right:
. - pop & print chr L 33,0,0,0,...
- back to ":"
- elif TOS == -1 left:
@ - exit
* right, but on the first occasion (from above) we hit the wall and turn
around, so that's like a left
Luckily we don't need to handle un-printables, otherwise the zero-byte would turn us around at , and get output twice by .:. (with us hitting the wall at : and turning around).
$endgroup$
add a comment |
$begingroup$
Labyrinth, 19 11 10 bytes
3
3
:.
.,@
Try it online!
How?
I / O stack
0,0,0,...
3 - pop * 10 + 3 3,0,0,0,...
3 - pop * 10 + 3 33,0,0,0,...
: - duplicate 33,33,0,0,0,...
- T junction from the side
- 33 > 0 so turn*
. - pop & print chr ! 33,0,0,0,...
, - read chr or -1 L 76,33,0,0,0,...
- T junction from the base
- if TOS > 0 right:
. - pop & print chr L 33,0,0,0,...
- back to ":"
- elif TOS == -1 left:
@ - exit
* right, but on the first occasion (from above) we hit the wall and turn
around, so that's like a left
Luckily we don't need to handle un-printables, otherwise the zero-byte would turn us around at , and get output twice by .:. (with us hitting the wall at : and turning around).
$endgroup$
add a comment |
$begingroup$
Labyrinth, 19 11 10 bytes
3
3
:.
.,@
Try it online!
How?
I / O stack
0,0,0,...
3 - pop * 10 + 3 3,0,0,0,...
3 - pop * 10 + 3 33,0,0,0,...
: - duplicate 33,33,0,0,0,...
- T junction from the side
- 33 > 0 so turn*
. - pop & print chr ! 33,0,0,0,...
, - read chr or -1 L 76,33,0,0,0,...
- T junction from the base
- if TOS > 0 right:
. - pop & print chr L 33,0,0,0,...
- back to ":"
- elif TOS == -1 left:
@ - exit
* right, but on the first occasion (from above) we hit the wall and turn
around, so that's like a left
Luckily we don't need to handle un-printables, otherwise the zero-byte would turn us around at , and get output twice by .:. (with us hitting the wall at : and turning around).
$endgroup$
Labyrinth, 19 11 10 bytes
3
3
:.
.,@
Try it online!
How?
I / O stack
0,0,0,...
3 - pop * 10 + 3 3,0,0,0,...
3 - pop * 10 + 3 33,0,0,0,...
: - duplicate 33,33,0,0,0,...
- T junction from the side
- 33 > 0 so turn*
. - pop & print chr ! 33,0,0,0,...
, - read chr or -1 L 76,33,0,0,0,...
- T junction from the base
- if TOS > 0 right:
. - pop & print chr L 33,0,0,0,...
- back to ":"
- elif TOS == -1 left:
@ - exit
* right, but on the first occasion (from above) we hit the wall and turn
around, so that's like a left
Luckily we don't need to handle un-printables, otherwise the zero-byte would turn us around at , and get output twice by .:. (with us hitting the wall at : and turning around).
edited 1 hour ago
answered 5 hours ago
Jonathan AllanJonathan Allan
58.9k5 gold badges44 silver badges185 bronze badges
58.9k5 gold badges44 silver badges185 bronze badges
add a comment |
add a comment |
$begingroup$
Charcoal, 6 bytes
⭆S⁺!ι!
Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫S!
Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.
$endgroup$
add a comment |
$begingroup$
Charcoal, 6 bytes
⭆S⁺!ι!
Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫S!
Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.
$endgroup$
add a comment |
$begingroup$
Charcoal, 6 bytes
⭆S⁺!ι!
Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫S!
Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.
$endgroup$
Charcoal, 6 bytes
⭆S⁺!ι!
Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫S!
Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.
answered 10 hours ago
NeilNeil
87.5k8 gold badges46 silver badges183 bronze badges
87.5k8 gold badges46 silver badges183 bronze badges
add a comment |
add a comment |
$begingroup$
05AB1E, 7 bytes
Takes input as a list of characters.
'!ý'!.ø
Try it online! or Try it online! (with input as a string)
$endgroup$
add a comment |
$begingroup$
05AB1E, 7 bytes
Takes input as a list of characters.
'!ý'!.ø
Try it online! or Try it online! (with input as a string)
$endgroup$
add a comment |
$begingroup$
05AB1E, 7 bytes
Takes input as a list of characters.
'!ý'!.ø
Try it online! or Try it online! (with input as a string)
$endgroup$
05AB1E, 7 bytes
Takes input as a list of characters.
'!ý'!.ø
Try it online! or Try it online! (with input as a string)
edited 9 hours ago
answered 10 hours ago
Mr. XcoderMr. Xcoder
33.5k7 gold badges62 silver badges204 bronze badges
33.5k7 gold badges62 silver badges204 bronze badges
add a comment |
add a comment |
$begingroup$
Gema, 11 characters
A=!
?=?!
Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6n129591 129012 129127 129582nn0' | gema 'A=!;?=?!'
!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!
Try it online!
$endgroup$
add a comment |
$begingroup$
Gema, 11 characters
A=!
?=?!
Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6n129591 129012 129127 129582nn0' | gema 'A=!;?=?!'
!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!
Try it online!
$endgroup$
add a comment |
$begingroup$
Gema, 11 characters
A=!
?=?!
Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6n129591 129012 129127 129582nn0' | gema 'A=!;?=?!'
!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!
Try it online!
$endgroup$
Gema, 11 characters
A=!
?=?!
Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6n129591 129012 129127 129582nn0' | gema 'A=!;?=?!'
!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!
Try it online!
answered 9 hours ago
manatworkmanatwork
16.7k4 gold badges38 silver badges72 bronze badges
16.7k4 gold badges38 silver badges72 bronze badges
add a comment |
add a comment |
$begingroup$
Zsh, 32 bytes
for c ('' $(s::)1)echo -nE $c!
Try it online!
(s::) splits into characters, '' adds an empty element to the start, and then echo -nE $c! echoes each followed by an !.
$endgroup$
add a comment |
$begingroup$
Zsh, 32 bytes
for c ('' $(s::)1)echo -nE $c!
Try it online!
(s::) splits into characters, '' adds an empty element to the start, and then echo -nE $c! echoes each followed by an !.
$endgroup$
add a comment |
$begingroup$
Zsh, 32 bytes
for c ('' $(s::)1)echo -nE $c!
Try it online!
(s::) splits into characters, '' adds an empty element to the start, and then echo -nE $c! echoes each followed by an !.
$endgroup$
Zsh, 32 bytes
for c ('' $(s::)1)echo -nE $c!
Try it online!
(s::) splits into characters, '' adds an empty element to the start, and then echo -nE $c! echoes each followed by an !.
edited 9 hours ago
answered 9 hours ago
GammaFunctionGammaFunction
6118 bronze badges
6118 bronze badges
add a comment |
add a comment |
$begingroup$
Jelly, 5 bytes
Ż”!ṁż
A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s e.g. "abc"
”! - character '!' '!'
ṁ - mould like:
Ż - s with a zero prepended "!!!!"
ż - zip together with s ["!a","!b","!c",'!']
- implicit (smashing) print !a!b!c!
$endgroup$
add a comment |
$begingroup$
Jelly, 5 bytes
Ż”!ṁż
A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s e.g. "abc"
”! - character '!' '!'
ṁ - mould like:
Ż - s with a zero prepended "!!!!"
ż - zip together with s ["!a","!b","!c",'!']
- implicit (smashing) print !a!b!c!
$endgroup$
add a comment |
$begingroup$
Jelly, 5 bytes
Ż”!ṁż
A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s e.g. "abc"
”! - character '!' '!'
ṁ - mould like:
Ż - s with a zero prepended "!!!!"
ż - zip together with s ["!a","!b","!c",'!']
- implicit (smashing) print !a!b!c!
$endgroup$
Jelly, 5 bytes
Ż”!ṁż
A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s e.g. "abc"
”! - character '!' '!'
ṁ - mould like:
Ż - s with a zero prepended "!!!!"
ż - zip together with s ["!a","!b","!c",'!']
- implicit (smashing) print !a!b!c!
edited 7 hours ago
answered 8 hours ago
Jonathan AllanJonathan Allan
58.9k5 gold badges44 silver badges185 bronze badges
58.9k5 gold badges44 silver badges185 bronze badges
add a comment |
add a comment |
$begingroup$
SNOBOL4 (CSNOBOL4), 94 bytes
I I =INPUT :F(END)
S I LEN(1) . X REM . I :F(O)
O ='!' O X :(S)
O OUTPUT =O '!'
O = :(I)
END
Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in n or not.
$endgroup$
add a comment |
$begingroup$
SNOBOL4 (CSNOBOL4), 94 bytes
I I =INPUT :F(END)
S I LEN(1) . X REM . I :F(O)
O ='!' O X :(S)
O OUTPUT =O '!'
O = :(I)
END
Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in n or not.
$endgroup$
add a comment |
$begingroup$
SNOBOL4 (CSNOBOL4), 94 bytes
I I =INPUT :F(END)
S I LEN(1) . X REM . I :F(O)
O ='!' O X :(S)
O OUTPUT =O '!'
O = :(I)
END
Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in n or not.
$endgroup$
SNOBOL4 (CSNOBOL4), 94 bytes
I I =INPUT :F(END)
S I LEN(1) . X REM . I :F(O)
O ='!' O X :(S)
O OUTPUT =O '!'
O = :(I)
END
Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in n or not.
answered 6 hours ago
GiuseppeGiuseppe
19.1k3 gold badges16 silver badges67 bronze badges
19.1k3 gold badges16 silver badges67 bronze badges
add a comment |
add a comment |
$begingroup$
Stax, 6 5 bytes
_z'!R
Run and debug it
Replace "" with "!" using regex replacement. I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10
If there is a match with an emptystring (in other words, if the value of regexp.lastIndex is left unchanged), increment regexp.lastIndex by 1.
Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.
- If input was provided in an escaped literal e.g.
"line1nline2". But I opted against that for the sake of "usability". - If there was not a
bugfeature in stax's zip implementation when encountering empty strings/arrays.
$endgroup$
add a comment |
$begingroup$
Stax, 6 5 bytes
_z'!R
Run and debug it
Replace "" with "!" using regex replacement. I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10
If there is a match with an emptystring (in other words, if the value of regexp.lastIndex is left unchanged), increment regexp.lastIndex by 1.
Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.
- If input was provided in an escaped literal e.g.
"line1nline2". But I opted against that for the sake of "usability". - If there was not a
bugfeature in stax's zip implementation when encountering empty strings/arrays.
$endgroup$
add a comment |
$begingroup$
Stax, 6 5 bytes
_z'!R
Run and debug it
Replace "" with "!" using regex replacement. I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10
If there is a match with an emptystring (in other words, if the value of regexp.lastIndex is left unchanged), increment regexp.lastIndex by 1.
Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.
- If input was provided in an escaped literal e.g.
"line1nline2". But I opted against that for the sake of "usability". - If there was not a
bugfeature in stax's zip implementation when encountering empty strings/arrays.
$endgroup$
Stax, 6 5 bytes
_z'!R
Run and debug it
Replace "" with "!" using regex replacement. I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10
If there is a match with an emptystring (in other words, if the value of regexp.lastIndex is left unchanged), increment regexp.lastIndex by 1.
Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.
- If input was provided in an escaped literal e.g.
"line1nline2". But I opted against that for the sake of "usability". - If there was not a
bugfeature in stax's zip implementation when encountering empty strings/arrays.
edited 4 hours ago
answered 6 hours ago
recursiverecursive
7,94115 silver badges31 bronze badges
7,94115 silver badges31 bronze badges
add a comment |
add a comment |
$begingroup$
Triangular, 15 bytes
B.3.*#).(/?~@<
Try it online!
Ungolfed:
B
. 3
. *
# ) . (
/ ? ~ @ <
----------------------------------------------------------
B3* - Push 11 and 3, then pop both and push their product
(< - Set jump position and change direction
@ - Print Top of Stack as a character without popping
~ - Push a character read from input (-1 if no input)
?/ - Skip next instruction if ToS <= 0
# - Print ToS as a character, pop ToS
) - Jump to position previously set
$endgroup$
add a comment |
$begingroup$
Triangular, 15 bytes
B.3.*#).(/?~@<
Try it online!
Ungolfed:
B
. 3
. *
# ) . (
/ ? ~ @ <
----------------------------------------------------------
B3* - Push 11 and 3, then pop both and push their product
(< - Set jump position and change direction
@ - Print Top of Stack as a character without popping
~ - Push a character read from input (-1 if no input)
?/ - Skip next instruction if ToS <= 0
# - Print ToS as a character, pop ToS
) - Jump to position previously set
$endgroup$
add a comment |
$begingroup$
Triangular, 15 bytes
B.3.*#).(/?~@<
Try it online!
Ungolfed:
B
. 3
. *
# ) . (
/ ? ~ @ <
----------------------------------------------------------
B3* - Push 11 and 3, then pop both and push their product
(< - Set jump position and change direction
@ - Print Top of Stack as a character without popping
~ - Push a character read from input (-1 if no input)
?/ - Skip next instruction if ToS <= 0
# - Print ToS as a character, pop ToS
) - Jump to position previously set
$endgroup$
Triangular, 15 bytes
B.3.*#).(/?~@<
Try it online!
Ungolfed:
B
. 3
. *
# ) . (
/ ? ~ @ <
----------------------------------------------------------
B3* - Push 11 and 3, then pop both and push their product
(< - Set jump position and change direction
@ - Print Top of Stack as a character without popping
~ - Push a character read from input (-1 if no input)
?/ - Skip next instruction if ToS <= 0
# - Print ToS as a character, pop ToS
) - Jump to position previously set
answered 3 hours ago
squidsquid
4917 bronze badges
4917 bronze badges
add a comment |
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
r Replace
P all empty strings "" with
'! An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
r Replace
P all empty strings "" with
'! An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)
$endgroup$
add a comment |
$begingroup$
Japt, 4 bytes
rP'!
Try it
r Replace
P all empty strings "" with
'! An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)
$endgroup$
Japt, 4 bytes
rP'!
Try it
r Replace
P all empty strings "" with
'! An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)
answered 3 hours ago
Embodiment of IgnoranceEmbodiment of Ignorance
5,0661 silver badge30 bronze badges
5,0661 silver badge30 bronze badges
add a comment |
add a comment |
$begingroup$
Perl 5 + -p, 11 bytes
s/^|.K/!/g
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 + -p, 11 bytes
s/^|.K/!/g
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 + -p, 11 bytes
s/^|.K/!/g
Try it online!
$endgroup$
Perl 5 + -p, 11 bytes
s/^|.K/!/g
Try it online!
answered 2 hours ago
Dom HastingsDom Hastings
15k3 gold badges34 silver badges71 bronze badges
15k3 gold badges34 silver badges71 bronze badges
add a comment |
add a comment |
$begingroup$
Pyth, 8 bytes
+!s+R!
Try it online!
Code | Explanation
----------+-------------------------------------
+!s+R! | Code
+!s+R!Q | with implicit variables filled
----------+-------------------------------------
R Q | For each d in input, replace d with:
+R! | d+"!"
s | Join results on empty string
+! | Add "!" to beginning
| Print (implicit)
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
+!s+R!
Try it online!
Code | Explanation
----------+-------------------------------------
+!s+R! | Code
+!s+R!Q | with implicit variables filled
----------+-------------------------------------
R Q | For each d in input, replace d with:
+R! | d+"!"
s | Join results on empty string
+! | Add "!" to beginning
| Print (implicit)
$endgroup$
add a comment |
$begingroup$
Pyth, 8 bytes
+!s+R!
Try it online!
Code | Explanation
----------+-------------------------------------
+!s+R! | Code
+!s+R!Q | with implicit variables filled
----------+-------------------------------------
R Q | For each d in input, replace d with:
+R! | d+"!"
s | Join results on empty string
+! | Add "!" to beginning
| Print (implicit)
$endgroup$
Pyth, 8 bytes
+!s+R!
Try it online!
Code | Explanation
----------+-------------------------------------
+!s+R! | Code
+!s+R!Q | with implicit variables filled
----------+-------------------------------------
R Q | For each d in input, replace d with:
+R! | d+"!"
s | Join results on empty string
+! | Add "!" to beginning
| Print (implicit)
answered 2 hours ago
hakr14hakr14
1,2454 silver badges10 bronze badges
1,2454 silver badges10 bronze badges
add a comment |
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!String.Join("!",s)!"
Try it online!
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!String.Join("!",s)!"
Try it online!
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!String.Join("!",s)!"
Try it online!
$endgroup$
C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!String.Join("!",s)!"
Try it online!
edited 2 hours ago
answered 2 hours ago
danadana
2,4011 gold badge7 silver badges9 bronze badges
2,4011 gold badge7 silver badges9 bronze badges
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f190223%2finsert-between%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
$begingroup$
very similar question
$endgroup$
– Giuseppe
10 hours ago
$begingroup$
I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)
$endgroup$
– A__
10 hours ago
$begingroup$
Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."
$endgroup$
– A__
7 hours ago
2
$begingroup$
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).
$endgroup$
– Jonathan Allan
7 hours ago
3
$begingroup$
Downvotes are inserted between every upvote, just like what the challege describes.
$endgroup$
– A__
6 hours ago