"DDoouubbllee ssppeeaakk!!"

63

18

Super simple challenge today, or is it?

I feel like we've heard a fair bit about double speak recently, well let's define it in a codable way...

Double speak is when each and every character in a string of text is immediately repeated. For example:

"DDoouubbllee  ssppeeaakk!!"

The Rules

  • Write code which accepts one argument, a string.
  • It will modify this string, duplicating every character.
  • Then it will return the double speak version of the string.
  • It's code golf, try to achieve this in the smallest number of bytes.
  • Please include a link to an online interpreter for your code.
  • Input strings will only contain characters in the printable ASCII range. Reference: http://www.asciitable.com/mobile/

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

var QUESTION_ID=188988;
var OVERRIDE_USER=53748;
var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(d){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+d+"&pagesize=100&order=asc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(d,e){return"https://api.stackexchange.com/2.2/answers/"+e.join(";")+"/comments?page="+d+"&pagesize=100&order=asc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){answers.push.apply(answers,d.items),answers_hash=[],answer_ids=[],d.items.forEach(function(e){e.comments=[];var f=+e.share_link.match(/\d+/);answer_ids.push(f),answers_hash[f]=e}),d.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(d){d.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),d.has_more?getComments():more_answers?getAnswers():process()}})}getAnswers();var SCORE_REG=function(){var d=String.raw`h\d`,e=String.raw`\-?\d+\.?\d*`,f=String.raw`[^\n<>]*`,g=String.raw`<s>${f}</s>|<strike>${f}</strike>|<del>${f}</del>`,h=String.raw`[^\n\d<>]*`,j=String.raw`<[^\n<>]+>`;return new RegExp(String.raw`<${d}>`+String.raw`\s*([^\n,]*[^\s,]),.*?`+String.raw`(${e})`+String.raw`(?=`+String.raw`${h}`+String.raw`(?:(?:${g}|${j})${h})*`+String.raw`</${d}>`+String.raw`)`)}(),OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(d){return d.owner.display_name}function process(){var d=[];answers.forEach(function(n){var o=n.body;n.comments.forEach(function(q){OVERRIDE_REG.test(q.body)&&(o="<h1>"+q.body.replace(OVERRIDE_REG,"")+"</h1>")});var p=o.match(SCORE_REG);p&&d.push({user:getAuthorName(n),size:+p[2],language:p[1],link:n.share_link})}),d.sort(function(n,o){var p=n.size,q=o.size;return p-q});var e={},f=1,g=null,h=1;d.forEach(function(n){n.size!=g&&(h=f),g=n.size,++f;var o=jQuery("#answer-template").html();o=o.replace("{{PLACE}}",h+".").replace("{{NAME}}",n.user).replace("{{LANGUAGE}}",n.language).replace("{{SIZE}}",n.size).replace("{{LINK}}",n.link),o=jQuery(o),jQuery("#answers").append(o);var p=n.language;p=jQuery("<i>"+n.language+"</i>").text().toLowerCase(),e[p]=e[p]||{lang:n.language,user:n.user,size:n.size,link:n.link,uniq:p}});var j=[];for(var k in e)e.hasOwnProperty(k)&&j.push(e[k]);j.sort(function(n,o){return n.uniq>o.uniq?1:n.uniq<o.uniq?-1:0});for(var l=0;l<j.length;++l){var m=jQuery("#language-template").html(),k=j[l];m=m.replace("{{LANGUAGE}}",k.lang).replace("{{NAME}}",k.user).replace("{{SIZE}}",k.size).replace("{{LINK}}",k.link),m=jQuery(m),jQuery("#languages").append(m)}}
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654"> <div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> 

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, [Other information] N bytes

where N is the size of your submission. Other information may include flags set and if you've improved your score (usually a struck out number like <s>M</s>). N should be the right-most number in this heading, and everything before the first , is the name of the language you've used. The language name and the word bytes may be links.

For example:

# [><>](http://esolangs.org/wiki/Fish), <s>162</s> 121 [bytes](https://esolangs.org/wiki/Fish#Instructions)

AJFaraday

Posted 2019-07-31T09:57:51.833

Reputation: 10 466

1It will modify this string. Are you intentionally requiring pass-by-reference and modify in-place? And then return a copy or reference to that modified string? If so, languages like asm or C would need to accept an explicit-length string (pointer + length) where the length is either the current string length (with the buffer being twice that size), or it's the total size and you need to duplicate the low half. Thus you need to start from the end and work backwards, or allocate scratch space and then copy back. But there are answers in C and 8086 asm that totally violate all that. – Peter Cordes – 2019-08-03T01:49:06.843

3@PeterCordes I do not care if it modifies the same object or builds a new one. – AJFaraday – 2019-08-03T05:08:58.747

2I'd suggest wording it as "modify (or produce a modified copy) of the string" to explicitly allow answers that do or don't modify in-place. Simplifying the wording to "return a string that's twice as long, with each character repeated" would be nice but then it's not clear if void foo(char *c, size_t len) is legal that takes one input/output buffer and a length, and doesn't have any return value, just a side-effect on the object it has a pointer to. – Peter Cordes – 2019-08-03T05:16:40.117

Can the string be empty? – cschultz2048 – 2019-08-06T19:58:22.777

1@cschultz2048 it says the string will only contain printable ascii characters, so that implies that they’ll always be populated. I’d expect that any code for this challenge would leave an empty string empty... anyway, I don’t think it’s a test case that I’d use for this. – AJFaraday – 2019-08-06T22:36:40.480

Does this answer your question? Stretching Words Because when you make the two operands in any submission to that challenge equal, programs will obey the behavior described in this challenge. An example of this behavior is here.

– None – 2020-01-02T12:29:41.150

@a'_' I'm pretty sure being a subset of another question doesn't make a question a duplicate; otherwise most challenges could be closed as duplicates of, say, "Interpret brainfuck". – my pronoun is monicareinstate – 2020-01-02T13:32:31.443

@mypronounismonicareinstate I've been known to write challenges which expand on my previous challenges. – AJFaraday – 2020-01-02T13:33:35.173

Then see this post.

– None – 2020-01-02T13:46:04.630

I respectfully disagree. – AJFaraday – 2020-01-02T13:50:30.850

Answers

122

Malbolge, 20775 and 2334 bytes

Probably I didn't beat anyone with it, but it was incredibly fun to make.

bP&A@?>=<;:9876543210/.-,+*)('&%$T"!~}|;]yxwvutslUSRQ.yx+i)J9edFb4`_^]\yxwRQ)(TSRQ]m!G0KJIyxFvDa%_@?"=<5:98765.-2+*/.-,+*)('&%$#"!~}|utyrqvutsrqjonmPkjihgfedc\DDYAA\>>Y;;V886L5322G//D,,G))>&&A##!7~5:{y7xvuu,10/.-,+*)('&%$#"yb}|{zyxwvutmVqSohmOOjihafeHcEa`YAA\[ZYRW:U7SLKP3NMLK-I,GFED&%%@?>=6;|9y70/4u210/o-n+k)"!gg$#"!x}`{zyxZvYtsrqSoRmlkjLhKfedcEaD_^]\>Z=XWVU7S6QPON0LKDI,GFEDCBA#?"=};438y6543s1r/o-&%*k('&%e#d!~}|^z]xwvuWsVqponPlOjihgIeHcba`B^A\[ZY;W:UTSR4PI2MLKJ,,AFE(&B;:?"~<}{zz165v3s+*/pn,mk)jh&ge#db~a_{^\xwvoXsrqpRnmfkjMKg`_GG\aDB^A?[><X;9U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BA@?>=6;|987x54t21r/o'&+lj(ig%fd"ca``uzy\wYonsVTpSQmPNjMKgfIGc\[`_^A@[ZYXWVUTMR5PONML.DIHGF(>'<A@9>=6;|98y654tt+0/p-m%$)('hg|eccb}v{^yxwZutVrqToQgfkNLhgJeG]\aDBAAV[Z=X:POT7544INM0.JCBG*(D'%A$">!};|z8yw543ts0).o,+*)j'&%eezbbw|{z]\wvoXVVUponglOjihgJedcEEZ_^A?[TSX;9UT7R4JIN1/K.,H+)E(&B%#?"~<}{9zx6wutt+0/.on+*)"'h%$#"c~}|^^sxwZuWmlqTRnQOkjMhJ`_dGEaDB^A?[><X;9U86R53ON1L.DCHGF)(CBA@9"~~}:9876/4u210/p-,l*kihh}$#db~wv{^\[[putWUqjinQOkjMhJ`_dGEaDB^A?[><X;9U8655JONM0/JIHGF?D'BA@?"=<;{{2xx/432sr/.-,+*)(!h%$#"!aw|{zy[qZotsrkpinQOONchKfedcFa`B^A?[Z=X:POT7544INM0K-CBG*(D'%A$">!};|z8yw5vtss*/.-nm$)j'&%$e"!a}`^]]rwvYWslkpSQmPNjMKgJHdGEaDB^A?[ZY<;VO8665POHM0KJ-HGFED'%A:9>!}||387x5u-,1rp.-n+k#"'hf$ec!b`|_]y\ZvYWsVTpSQmlkNMhg`eHFFE`_^]V[>YXW:UTS55JON1L.DCH+)E(&BA$?!76;|z8yw54u2r*).om+lj('h%e{z!b`|{z]\wvutmrUponQOediLJII^cbEC_XW\?=Y<:V97S64P31M0.J-+G*(D'%$$9>=<}|98765.ussr/.-,+*#(i&%$e"!~``u]]rwvuXWrqponmfkNihKfeGcFD`CA]@>==RWV9T6LKP31M0.J-+G*(D'%A$">=<}|9876543,s0/p-,lkk"'&ge#zy~a_{^\x[YutWUqjinQONNchgfIHcba`_^]\UZ=XWVUT6LQPON0F/DIHG@E>C&A@#>=<||387x5u-,1rp.om+lj(ig%fd"ca}`^zy\wYonsVTpSQmPNMMbgfeHG\ECCB]V[>YXW:UT6R53O20//DIH+)E>=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edGbDZY^A?[><X;9U86R53O20LKJ-,AF)DC&$:9>!}||387x5u-,1rp.-n+k#"'hf$ec!b`|_]y\ZvYWsVTpSQmlkNMhaJedGba`BBW\[><XQPU8655JON1/KDCH+)E(&B%#?"~<;:{z76/4u21r/.n,+l)i!~%fd"ca}`^z][wZXtWUqpSnPfejMKgJHdGEa`_BA\[ZS<::9TSRQJO2MLK.IH*F)'C&$@#!=~|:{y7xv43t1q)(-nl*ki'hf$#d!awv{^\x[YutsVUponmfkNihgJedFbaD_AWV[><;;PUT75QJIN1/..CHG*(D=<A$">=~|:327xv4us1rp.om+lj(ig%$#dc~}|{zs\wvYtsUTTinmPNjcbgJHdGEaDB^A?>>SXW:U7MLQPO21LKJIHG@E(CBA$"87}}4987xw43210/.'nllk('&%$#"!x}`{z][qpuXVUUjonQlNdchKIedGbDZY^A?[><X;9U86R53O20L/-I,*FED'&A@?>=<;:38y65432r*/.-,l$k"'&%|#z!b}|_zyxZZotsVTpihmPNMMbgfIGc\[`CA]\?Z<RQV97S64P3100EJIH+*?(&&%@9>!<;|98x65v3s+*/pn,mk)jh&ge#db~a_{^\x[YuXVUUjonmPOjchKIIHcb[D_^]@[Z<XW:8TMLQ42N1/KJ-H*@?D'%A@#>~65:{y7xv4us1rp.om+ljii~%$#dc~}v_]]\wvunsVqpSnmONNchgJHd]\aDB^]@[=SRW:8T75Q42N1/KJ-H*@?D'%A$">=~|:327xvuu,10/po,+*#(iggf#"!~}v{^yx[YonVVkponQPkjihg`eHFFE`_^]\[T=XWV9TS5Q42N1/K.,H+)ED'%A:9>!};|z87x5u-,1rp.om+lj(ig%$e"bxw|_]\\qvutWVqponmleNihKfeGcFDCCX]\?Z<RQV97S64PO20LEDI,*F)'C&$@#!=~|:{yxx/432sr/.-,+*)"'h%$#d!~`|{^y[qpuXVrqToQgfkNLhgJeG]\aDB^A?[><X;9U86R53O20//DIHG*)DCBA@?>=6}:9876v.3210p(o&+*#('~%fddcx}`{z]xwYutWrTjinQOkjMhJ`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E(&B%#?"~<;:{z7654-2s0/pn,+*)(ih%$#"!xa__^yxwvutmrUponQOedLLafedGFa`_^]\UZ=XWV9TS5Q42NM0.JCBG*(DC&A#98=~|{{276w4t,+0qo-nl*ki'hf$ec!b`|_]yxwZYtsrqpongPkjMhgfHH]baD_AWV[ZY<;VUTSRQPOHM0KJIHG)?DCBA#9"7<;49816w432s0/.nn%*)j'g}|#db~a_{z][wpotWUTTinmPNjcbgJHdGEaDB^A?[><X;988MRQP32G0..-HAF)DC&$:9>!}||387x5u-,1rp.-n+k#"'hf$ec!b`|_]y\ZvYWsVTpSQmlkNMhafIdcFa`_AAV[Z=;WPOT7544INM0.JCBG*(DC&A#98=~|:{y7xvuu,10/po,+$kiih%$#z!b}|{^yxwYYnsrUSohglOMihKIe^]bEC_^A\>TSX;9U86R53O20L/-I,*F)'C&$@?>!~;:927x54us10/.-nm*)('~geed!~}|{ty\wvuXVlkSShmlkNMhgfed]bE`_B]\>ZY<W9ONS64PO2M/EDI,*F)'C&$@#!=~|:{y7xv4us10/po,+*)('~geed!~}|{zyrwZutWUkponmPOjihgfed]bE`_B@VU==RWVU87RQPONMLKD-HGFED&<A@?>~6}498705.3trrq(-n+*)j'&feez!~a|^tsx[YuXVUUjonQlNdchKIedGbDZY^A?[Z=X:POT75Q42N1/K.,HGF)(=B%@?"=<;{{276wu3,+0qonn%*)jh&}|#db~}`{]srwZXtWUqTRnmPkMcbgfeHGb[DBBA\[TY<WVU86LKP31ML/-IBAF)'CB%#?87<}{zz165vt2+*/pn,mk)jh&ge#db~a_^^sxwvYXsrkpSnmPNdchKIHH]baD_AWV[><XW:U7MLQ42N1/K.,H+)E(&B%#?"~<}{987xw432+r/.o,+*jj!&%fd"yx}`^]]rwvYWslkpSQmPNjMKgJHdcbED_^]\UZ=XWV9TSR44INM0.JCBG*(DC&$@98=~|:9z7w/.3tr0qo-nl*ki'hf$ec!b`|_]yxwZYtsrqpiRPPOjihgfe^cFa`_B@VU==RWVU87RQPONMLE.,,+F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{zEhgT4u,>*);'nJIkiEW210SRQ=<*;(K&I$tslk}BA@?eMv;(JI$F""mB^|i>>=vW)9'7%$#2NlYX-,HA@)''%%_?8[~;{zzVCT.d,s*N_n,mk6"FDCCTA?>P+{z(xq655s22}S/gfkjLL:fIH#EE!YAjVzgYX:)(s65p]m[MY/hCB+)RcPa$#""=<|43ixwS4Q2P*`p'KJHZ(!WVBec!-P=*ML9J6$GF3q10A-O>=c;(J%HGF!~_^0?.-w+QcUs`p4JmH1//{gyxeRQ

Try it online!

If the challenge didn't require halting at some point (eg. eof), it becomes pretty trivial, scoring 2334 bytes:

bP&A@?>=<;:9876543210/.-,+*)('&%$T"!~}|;]yxwvutslUSRQ.yx+i)J9edFb4`_^]\yxwRQ)(TSRQ]m!G0KJIyxFvDa%_@?"=<5:98765.-2+*/.-,+*)('&%$#"!~}|utyrqvutsrqjonmPkjihgfedc\DDYAA\>>Y;;V886L5322G//D,,G))>&&A##!7~5:{y7xvuu,10/.-,+*)('&%$#"yb}|{zyxwvutmVqSohmOOjihafeHcEa`YAA\[ZYRW:U7SLKP3NMLK-I,GFED&%%@?>=6;|9y70/4u210/o-n+k)"!gg$#"!x}`{zyxZvYtsrqSoRmlkjLhKfedcEaD_^]\>Z=XWVU7S6QPON0LKDI,GFEDCBA#?"=};438y6543s1r/o-&%*k('&%e#d!~}|^z]xwvuWsVqponPlOjihgIeHcba`B^A\[ZY;W:UTSR4PI2MLKJ,,AFE(&B;:?"~<}{zz165v3s+*/pn,mk)jh&ge#db~a_{^\xwvoXsrqpRnmfkjMKg`_GG\aDB^A?[><X;9U86R53ONM0KJC,+FEDC&A@?!!6||3876w4-tr*/.-&+*)('&%$e"!~}|utyxwvutWlkponmlOjchg`edGba`_XW\?ZYRQVOT7RQPINML/JIHAFEDC&A@?>!<;{98yw5.-ss*/pn,+lj(!~ff{"ca}`^z][wZXtWUqTRnQOkNLhgfIdcFaZ_^A\[Z<XW:U8SRQPOHML/JIHG*ED=%%:?>=~;:{876w43210/(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A@#!=65:{yxx/43tr0)(-nlkk"'&ge#zy~}|_ty\wvYWmlqTRnmPkMcbgJHdcFaCYX]@>==RWV97SLKP31M0.J-+G*(D'%A$">!}||3876wv-t10/p-,l*)(i~%fddcx}`{zy\wvXtWUqTRnQOkjMhJ`_dGEDDY^]@[=SRW:877LQP3N0FEJ-+**?DC&A#98=~|{{276w4t,+0qonn%*)j'g}|#db~a_^^sxwvYXmrUponQlkMiLJfIGFF[`_B@\UTY<:99NSR53OHGL/-,,AFE(&B;:?"~}}498yw5.-2sq/.-n%l)('&%$e@b>,+^^:87Z5n"!10/QP-kMv(gf%Gc543}|0{[-YXu)t87L5]Ol~jjiz++evbaa`M^!=Z|kWWD05S3?O*)o'JJH)F!~f1TAy>,<^]:xJ6YXmlD0SAQPk+vKaJ%%F5ECCX|zz=xRQ

Try it online!

Explanation

I've been asked to explain how the program works. I'll pick on the second one as it's way easier to explain it than the first one, but the way both of these work is really similar.

Let's start things off with decrypting the code. As someone down in the comments did it before I started working on the explanation, so I really advise you to check it out.

It doesn't make reading the program any easier one would say, but before we jump straight into the code, let's review basics of Malbolge.

The virtual machine is based on trits (trinary digits). Each machine word is ten trits wide, making it range from 0 to 2222222222t (= 59048d). Each memory position holds a machine word; the addresses are one machine word wide too. Both data and code share the same memory space.

There are three registers, each of which holds one machine word, initially 0: the code register C which is a pointer to the instruction that is about to be executed, the data register D used for data manipulation and the accumulator A also used by several instructions to manipulate data.

If the instruction to execute is not in the range 33-126, execution stops (the reference interpreter hangs in this case due to a bug). Otherwise, in order to determine the actual instruction to execute, the value pointed to by the C register is added to the C register itself and the result divided by 94, taking the remainder.

Here is a table of all possible instructions.The table

Now as the code is more understandable and it's actually possible to tell what is happening there, we can jump to the general idea of what is happening there.

Without any jumps, programming Malbolge is pretty much trivial. When the jumps are used though, there is decrypting task needed to be done before executing this code again. Everytime an instruction is executed, it's getting straight after encrypted, so it doesn't behave this way it did before.

To illustrate the workaround, let's look at normalized Malbolge cat program:

jpoo*pjoooop*ojoopoo*ojoooooppjoivvv
o/i<iviv
i<vvvvvvvvvvvvv
oji

So as you can see, on the second line we have / and < instructions dealing with I/O stuff. Utilizing the fact that C register is the instruction pointer, we can modify it using i instruction effectively creating a branch. Before the branch happens though, we need to decrypt instructions that just a few cycles away read and wrote output to and from TTY, combined with a jump. As there is no real way to store constants effectively, we need to embed many non-related instructions and use their value to compute other constants needed (utilizing the fact that Malbolge doesn't separate program and data)

Note: Parts of this answer were taken from Esolang wiki Malbolge page licensed under CC0 - link.

Possibly, you might want to check my other answer featuring Seed

Krzysztof Szewczyk

Posted 2019-07-31T09:57:51.833

Reputation: 3 819

15Woah! How did you make this? How do you program in Malbolge? (these are serious questions, by the way) – MilkyWay90 – 2019-07-31T18:45:10.320

40The day that someone writes, in Malbolge, a program that simply copies its input to it's output, is the day my hair spontaneously turns green. It's the day that elephants are purple and camels fly, and a cow can fit through a needle's eye. This seems to surpass that. – Adám – 2019-07-31T20:16:46.740

21@Adám, by a factor of 2, at least. – Shaggy – 2019-07-31T20:56:55.253

12First time hearing of Malbolge, but reading those docs all I can think of is: dang, this is an impressive answer. Is it possible to explain your code, or is it beyond explaining? ;) – Kevin Cruijssen – 2019-07-31T20:58:26.063

1Seriously, I've always been interested in programming in Malbolge, but I'm always confused by the docs – MilkyWay90 – 2019-08-01T05:01:34.097

8Malbolge specification document: "Malbolge" is the name of Dante's Eighth Circle of Hell, in which practitioners of deception (seducers, flatterers, simonists, thieves, hypocrites, and so on) spend eternity. Krzysztof Szewczyk: It was incredibly fun to make. – Charlie – 2019-08-01T07:22:23.557

25+1 for "it becomes pretty trivial" – Arnauld – 2019-08-01T09:57:42.430

1If you can add (some sort of) an explanation, I'd love to throw a bounty your way. – Shaggy – 2019-08-01T10:51:07.390

Here's what the shorter code looks like when decrypted and before running it. Malbolge commands are j, i, *, p, <, /, v, o. – Charlie – 2019-08-01T11:36:31.977

2The fact that this was done in a few hours... let alone, done at all. Phew. I read your paper on the turing completeness of seed, might you have written a Malbolge transpiler? – Alice – 2019-08-01T20:09:22.680

@Dylan do you have a link to that? – Jonah – 2019-08-01T21:18:08.600

3

Thank you for the explanation. Thank you so much. @Jonah Link to Seed Turing Completeness

– MilkyWay90 – 2019-08-01T21:24:48.263

@Shaggy would you care to drop that bounty? – Krzysztof Szewczyk – 2019-08-02T11:51:17.033

@KrzysztofSzewczyk, absolutely! I'm gone offline for the (bank holiday) weekend; if I haven't set the bounty up by Tuesday lunchtime (GMT), please ping me again to remind me. – Shaggy – 2019-08-02T21:42:43.857

1this program was generated by another program? not handwritten? – theonlygusti – 2019-08-03T15:36:00.437

You forgot to remind me! Remember to remind me tomorrow. – Shaggy – 2019-08-11T21:47:47.423

1@Shaggy I'm here! – Krzysztof Szewczyk – 2019-08-12T11:47:11.930

5Thanks for the reminder - you can expect +200 rep in ~24 hours :) – Shaggy – 2019-08-12T11:57:45.387

How did you decrypt the code after jumping back with the i instruction (I can see a lot of p, *, and j, but how does it play into the program)? Also, why are there multiple halt, input, and output instructions? – MilkyWay90 – 2019-08-22T14:50:24.067

@MilkyWay90 there are multiple halt, input and output instructions, because malbolge is storing data in the same memory where it stores code. Does it hint anything to you :)? – Krzysztof Szewczyk – 2019-08-22T15:29:49.317

@KrzysztofSzewczyk Are those the backup I/O and halting instructions in case one of them gets modified? – MilkyWay90 – 2019-08-22T16:03:46.203

1

Partially yes, partially no. There needs to be zero halting instruction, as this program doesn't halt. These "instructions" are serving different purpose. You might want to check this wiki page to clarify state of art a bit. Or try to analyze the code yourself (the recommended way - you will learn a lot, and the process will be really enjoyable)

– Krzysztof Szewczyk – 2019-08-22T16:15:13.533

91

brainfuck, 6 bytes

,[..,]

Try it online!

For once, a really competitive answer in brainfuck. :-) It just reads from the standard input (,), then loops while the character read is not zero ([), writing the character read twice (..) and finally reading a new character (,) before going back to the start of the loop (]).

Alternative 6-byte answer:

+[,..]

Try it online!

Charlie

Posted 2019-07-31T09:57:51.833

Reputation: 11 448

10It had to happen sometime. – AJFaraday – 2019-07-31T20:28:40.583

15given brainfuck's 8 instructions, could be argued as 2.25 bytes? – speedstyle – 2019-08-01T03:12:17.400

49

Seed, 6013 3942 3884 3865 3848 bytes

6 2686150228553910251590139707025615036563204497823963635717768129239771871066022173506550480510882628259267028226290577985584582829987099606110915656117177113555095646841841520224800333754793732176561479800611856258812006670385981709167679328497862503284773114717364645850756926464567857029605682209030697372493435852024478962025612141035167904456425050991742516020282696732660004824569723936406080643638019715421991278634074220365586727498681650073989748857985341022350116695714407041551609933358182688736747622670056818175549484918971558384479903673900409406866275258032866680967195428439907751537922194839977711106739550525066186108781580088916582559490041917035011328862266125578018990106393872489460844458091217404944194309597162769266585917996079831048944050703695352212652362891425728346891039020051565145149143668695374506752075410956647268061596926723805877631732070244839345640289062870487268706837056753112890753688530410829624567367052492603150395779619674714389456447573342335882718419424356991739625084740814435581409670174841935167450868967735568432921607395284483532735870628809137816139721467391760314297120583388009684979379888771619327969950939260709632318979448755571394507744993723267176377451465261335636767345281382139780890626858048062851714445255458413414708836044457819560626602471881203745677166851290194466534044374122781840150694963232713079984019097616802988558052961445185981197848860688635007868494303883280609553158126926303057368716954797175868772233997584782178460308584468311133667562020523260687787209651365697360075036255149184531675013585317549831215044187699501112214237282761452176427542227751840469500783022037518267131004723958694850409020207947539046371030202918430731468837057173037358435898981729128093138565524861044307737736772778645659866179416374742499528142506977571896833797572787168504674372995624869224644028121889021513694674680344413147327217671463636201883832593707987630471763158950694907193475270346642656464131212900528377257996057522592531063490286796434946290829640562975054259249630102041301990094261151488784971084438450904697283402436878185751193256803412549504172175692725366543545573099651580644132336272302990268431569623087644930350666119986012078396755208814027614451748455718916151950218835893255721018309717807161101069849247670957963270760531996609510342178009605381013854568528344071028665101709824510991652144229895556116304356971449229862349660751509158124118556805449346752918775201366378708970673708268140336609704879631200464020207189960217784283188350457711700181561855735903701439931161728546207607766764248018356183768557244013532032616392458312600465372655052565572757979232509950076857757257164261786986456779565081319671440867797151240096925123970490604003172676471092543424462070540303172987644037832692737644573481399927217285232015082118420498058022229538934735831710860610342762500071914715742707928060606416262583307855509796730058097681208691054336064995992598081644175617375019325706441005506100489323794725547244923204524790583484243672718647866979116309868261348266944902049457094368284266044502218232850494065571536043568039093446786891928597439310947971461490128765873399872574753055564655381318395939745692438909430171644009177696549501234738931977436030245682360974103741227416811200635596942701451202333113537361407624672328798572271366897755165037017879673502748767425083758652376018772700583221474572236166246539494675416322678094399996691972837962509574037110004298629947088012862552029152119412750923308070223808629424081676003170951500587426197322368913565250353332410276730344732325753114510178069340400741671217608323179698501977213623893949006870978691284571486316780769512681865771113879654002525802085758553029765815927252866913455193686303619992165147682671351400793392238437682055370542229871989802092530537034276944154276536658348210

Try it online!

Krzysztof Szewczyk

Posted 2019-07-31T09:57:51.833

Reputation: 3 819

1I've reached my daily vote limit, but I'll upvote this in 2 hours – MilkyWay90 – 2019-08-01T21:20:21.067

4I can't begin to understand this – AJFaraday – 2019-08-02T10:39:58.770

This has actually really surprised me, as this answer may be wayyy more impressive than the Malbolge one – Krzysztof Szewczyk – 2019-08-02T10:42:36.293

7Any chance you can explain how you got this one? Will such a description include the word 'trivial' at any point? – ouflak – 2019-08-02T13:38:38.030

1@ouflak well, this time, it won't include the word 'trivial', because the challenge required reversing the Mersenne Twister – Krzysztof Szewczyk – 2019-08-02T14:07:34.523

7How did you reverse the Mersenne Twister? – MilkyWay90 – 2019-08-03T05:28:50.433

Update: Cut the size by half – Krzysztof Szewczyk – 2019-09-08T08:21:28.203

2Soon I expect you'll post a thread on golfing tips for Seed. – ouflak – 2019-09-08T08:52:10.817

33

Jelly, 1 byte

Full program.

ż

Try it online!

Mr. Xcoder

Posted 2019-07-31T09:57:51.833

Reputation: 39 774

2Oh, I was too slow. Was just about to post – Adám – 2019-07-31T10:13:23.420

FWIW I'd note that this is a full program since as a monadic Link it accepts a list of characters but returns a list of lists of characters - so it accepts a Python string as an argument and prints the result (as does my 1 byter, although this one may be augmented to work as a Link (ż\F`), while mine cannot I believe) – Jonathan Allan – 2019-07-31T15:59:35.163

(Nick Kennedy points out mine can become a Link with uneval, eval :)) – Jonathan Allan – 2019-07-31T16:43:43.687

1@JonathanAllan Pfffft, uneval-eval :))) – Mr. Xcoder – 2019-07-31T16:48:50.303

This looks to me like 2 bytes character ... $ echo -n "ż" | hexdump -C<newline> 00000000 c5 bc |..| – Jakuje – 2019-08-01T07:37:57.827

3

@Jakuje Jelly has its own codepage, so each of the 256 characters it contains is encoded as 1 byte.

– Mr. Xcoder – 2019-08-01T07:46:25.090

26

Shakespeare Programming Language, 139 129 109 106 bytes

-3 bytes thanks to Jo King

N.Ajax,.Page,.Act I:.Scene I:.[Exeunt][Enter Ajax and Page]Ajax:Open mind.Speak thy.Speak thy.Let usAct I.

Try it online!

Spews warnings and terminates with an error. Deal with it.

NieDzejkob

Posted 2019-07-31T09:57:51.833

Reputation: 4 630

1@Jo King woah, this is a really clever use of [Exeunt]! – NieDzejkob – 2019-07-31T15:10:18.620

23

Haskell, 15 14 13 bytes

(>>=(<$"dd"))

Try it online!

or legibly:

\xs -> concatMap (\x -> map (const x) ['d','d']) xs

Explanation: Lists are a Monad in Haskell, and using the bind operator >>= is a concatMap, executing a function that takes an element and returns a list on each element of the list and then concatenating the resulting lists into one big list.

Now we just have to build a function that, given a value, returns a list of that value twice, which is accomplished by (<$"dd"), which can be read as "Take the list ['d','d'] and replace every element with the argument of this function. The "dd" could be any expression that results in a list of exactly two elements, but this is the shortest I could come up with.

Sacchan

Posted 2019-07-31T09:57:51.833

Reputation: 621

1using <$ was something I never would've thought of – Mega Man – 2019-08-04T19:09:13.317

3

@MegaMan Credit goes to Laikoni, who gave me that hint in another codegolf challenge a year ago https://codegolf.stackexchange.com/questions/6281/draw-a-sierpinski-triangle/165554#165554

– Sacchan – 2019-08-05T07:52:28.347

21

05AB1E, 2 bytes

ø˜ or øS  (both 05AB1E versions)
ζ˜ or ζS  (new 05AB1E version only)
€D or €Â  (new 05AB1E version only)
.ι        (new 05AB1E version only)
ºS        (new 05AB1E version only)
·S or xS  (legacy 05AB1E version only)
+S        (legacy 05AB1E version only) 

Ok, I give up. I'm unable to find a 1-byter to solve this. Loads of 2-byters, though..

Try ø˜ online or Try øS online.
Try ζ˜ online or Try ζS online.
Try €D online or Try €Â online.
Try online.
Try ºS online.
Try ·S online or Try xS online.
Try +S online.

I/O as a list of characters.

Explanation:

ø    # Zip/transpose the (implicit) input-list with itself
     #  i.e. ["a","b","c"] → [["a","a"],["b","b"],["c","c"]]
 ˜   # Deep flatten it
     # OR
 S   # Convert it to a flattened list of characters
     # (which will be output implicitly as result)

The only program which works the same in both versions of 05AB1E. :)

ζ    # Zip/transpose the (implicit) input-list with the (implicit) input-list
     #  i.e. ["a","b","c"] → [["a","a"],["b","b"],["c","c"]]
 ˜   # Deep flatten it
     # OR
 S   # Convert it to a flattened list of characters
     # (which will be output implicitly as result)

This version basically works the same as the one above for the new version. In the old version you would need an explicit pair first, and then you could zip/transpose that. Just ζ on a 1D list will be a no-op in the legacy version of 05AB1E.

€    # For each character in the (implicit) input-list,
     # keeping all values on the stack into the resulting list:
 D   # Duplicate it
     # OR
 Â   # Bifurcate it (short for duplicate & reverse copy)
     # (which will be output implicitly as result)

In the new version of 05AB1E, it keeps all values on the stack into the resulting list when doing a map. Whereas with the legacy version of 05AB1E it would only keep the top value. Which is why these only work in the new version.

.ι   # Interleave the (implicit) input-list with the (implicit) input-list
     # (which will be output implicitly as result)

This builtin wasn't there yet in the legacy version of 05AB1E.

º    # Mirror each value in the (implicit) input-list
     #  i.e. ["a","b","c"] → ["aa","bb","cc"]
 S   # Convert it to a flattened list of characters
     # (which will be output implicitly as result)

In the legacy version of 05AB1E, the horizontal mirror builtin would be instead of º. However, ∞S doesn't work in the legacy version, because it would implicitly convert the list to a newline-delimited string before mirroring it completely (Try it here), after which the S would also include these newlines.

·    # Double each character
     # OR
x    # Double each character (without popping)
     #  i.e. ["a","b","c"] → ["aa","bb","cc"]
 S   # Convert it to a flattened list of characters
     # (which will be output implicitly as result)

Double is short for 2*. In the new version of 05AB1E, build in Elixir, this only works on numeric values. The legacy version of 05AB1E was built in Python however, so 2* works similar and repeats the character.

+    # Append all characters in the (implicit) input-list at the same indices 
     # with the characters of the (implicit) input-list
     #  i.e. ["a","b","c"] → ["aa","bb","cc"]
 S   # Convert it to a flattened list of characters
     # (which will be output implicitly as result)

Again, because the legacy version of 05AB1E was built in Python, "a"+"a" results in "aa", whereas the + cannot be used to append strings in the new version. (PS: There is an append for strings which works in both version, which is «, but when giving two list arguments it will concatenate them together instead of merging each string at the same indices like the program above (Try it here).)

Kevin Cruijssen

Posted 2019-07-31T09:57:51.833

Reputation: 67 575

There's also ζ˜ for modern 05AB1E. – Grimmy – 2019-07-31T11:57:19.017

@Grimy Didn't realize that doesn't work in the legacy version. I thought it was the same as ø˜, so I didn't bother adding it as well. I have added it (as well as øS/ζS/xS). – Kevin Cruijssen – 2019-07-31T12:12:28.433

18

Pyramid Scheme, 229 218 213 bytes

    ^
   /l\
  /oop\
 ^-----^
 -^   ^-
 /[\ /]\
^---^---^
-^ / \  -^
^-/out\ / \
-^-----/set\
 -^   ^-----^
  -^  -    /+\
  / \     ^---^
 /arg\   /1\  -
^-----^  ---
-^    -
 -^
 / \
/arg\
-----^
    /1\
    ---

Try it online!

This can definitely be shorter. Input is taken via command line arguments. This equates to basically:

str = input()
n = 0
while str[n]:
  print(str[n]*2)
  n += 1 

With a few caveats, like the printing actually being handled in both the loop condition and the loop body.

Alternative 215 byter:

     ^
    /l\
   /oop\
  ^-----^
 /[\    -^
^---^   / \
-^ ^-^ /set\
^- -^-^-----^
-^ / \-    /+\
^-/out\   ^---^
-^-----  /1\  -
 -^      ---
  -^
  / \
 /arg\
^-----^
-^    -
 -^
 / \
/arg\
-----^
    /1\
    ---

Try it online!

Jo King

Posted 2019-07-31T09:57:51.833

Reputation: 38 234

3

The set can be shifted up and left without interfering with anything. Try it online!

– Khuldraeseth na'Barya – 2019-07-31T14:28:31.527

Pyramid Cult came to PPCG! – val says Reinstate Monica – 2019-08-01T09:59:38.483

15

Python, 34 25 bytes

lambda i:sum(zip(i,i),())

Try it online! Another one that returns a string instead of a list of characters:

for i in input():print(i,end=i)
for i in input():               asking for the input, and doing a 
                                for loop for every char in the string.
                 print(i,end=i) print the character, and then close 
                                the line with the same character.

Try it online!

user85052

Posted 2019-07-31T09:57:51.833

Reputation:

4lambda i:sum(zip(i,i),()) should do for -9. – Mr. Xcoder – 2019-07-31T10:16:28.130

@Mr.Xcoder this returns a list of characters, rather than a string. The original can be improved by 3 bytes, though: for i in input():print(i,end=i) – primo – 2019-07-31T11:18:43.440

lambda i:''.join(c*2 for c in i) 32 bytes but returns a string and not a list – Gábor Fekete – 2019-08-01T14:40:35.183

Still works with 31 bytes :) lambda i:''.join(c*2for c in i) – movatica – 2019-08-07T21:15:50.947

15

Jelly, 1 byte

A full program printing the result.

Try it online!

How?

Uses a bug feature...
Jelly's "double" atom, is implemented with Python's * and it vectorises, while Jelly's lists of characters (its only "strings") are implemented as lists of Python strings which are usually just one character long - that is until we realise that in Python 'blah'*2='blahblah'...

Ḥ - Main link: list of characters (as parsed from an argument as a Python string)
  -                       e.g. ['A','b','b','a']
Ḥ - double (vectorises)        ['AA','bb','bb','aa']
  - implicit, smashing print     AAbbbbaa

Jonathan Allan

Posted 2019-07-31T09:57:51.833

Reputation: 67 804

If you wanted to make a monadic link (rather than full program), you could use ḤṾV – Nick Kennedy – 2019-07-31T16:22:24.967

Ah, I had no idea that'd work - nice! – Jonathan Allan – 2019-07-31T16:41:31.153

Looks to me like three-bytes character: $ echo -n "Ḥ" | hexdump -C<newline>00000000 e1 b8 a4 |...| – Jakuje – 2019-08-01T07:40:40.170

1

@Jakuje The code is one byte, af, is just a visual representation of that byte, see Jelly's code-page (also linked in the header of the post).

– Jonathan Allan – 2019-08-01T08:47:11.393

15

Jelly, 1 byte

ż

Try it online!

Pardon my inexperience, I'm just getting started with Jelly. What I believe is happening is that we've defined a dyadic chain, which treats a single argument as both the left and right arguments. In this case, the chain consists of "zip; interleave x and y", interleaving the input string with itself.

Someone already posted a 1-byte Jelly solution, so I hope it's not bad manners to post mine.

Eric Burgess

Posted 2019-07-31T09:57:51.833

Reputation: 151

8Welcome to the site! It perfectly fine to post an answer that ties an existing one especially if your answer has an explanation and the other does not. – Post Rock Garf Hunter – 2019-07-31T20:59:49.743

12

JavaScript (Node.js), 22 bytes

Takes input as an array of characters.

s=>s.flatMap(c=>[c,c])

Try it online!


JavaScript (ES6), 26 bytes

Takes input as a string.

s=>s.replace(/./gs,c=>c+c)

Try it online!

Alternate version suggested by @PabloLozano:

s=>s.replace(/./gs,'$&$&')

Try it online!

Doing it the recursive way is also just as long:

f=([c,...s])=>c?c+c+f(s):s

Try it online!

Arnauld

Posted 2019-07-31T09:57:51.833

Reputation: 111 334

s=>s.replace(/./gs,c=>c+c) so that . also matches newlines – Nahuel Fouilleul – 2019-07-31T10:43:35.623

@NahuelFouilleul Good catch. Thanks! – Arnauld – 2019-07-31T10:47:53.110

Would s=>s.map(c=>c+c) not work? – Oliver – 2019-07-31T12:19:12.060

@Oliver Won't that result in something like ['a','b','c'] -> ['aa','bb','cc'] instead of the intended ['a','a','b','b','c','c'], though? – Kevin Cruijssen – 2019-07-31T12:22:54.077

1@KevinCruijssen The join('') should take care of that. On second thought, that may be augmenting the output in a non-standard way so that may not be valid. – Oliver – 2019-07-31T12:25:40.810

1@Oliver I don't think it's valid. My 05AB1E would have a few 1 byte solutions in that case. Default I/O for a string is either, well.. a string, or a list/array/stream of characters / single-char strings. ["aa","bb","cc"] is a list of strings however, neither a string nor list of characters of itself. Adding a join or flatten it to a list of characters is valid, but would have to be counted towards the byte-count. – Kevin Cruijssen – 2019-07-31T12:29:04.017

1@KevinCruijssen Yeah, I agree :-) – Oliver – 2019-07-31T12:30:53.633

Another option with replace and 26 characters: s=>s.replace(/./gs,'$&$&') – Pablo Lozano – 2019-08-01T15:22:39.373

@PabloLozano Added. :-) – Arnauld – 2019-08-01T15:33:14.630

12

PowerShell, 29 23 21 bytes

-6 bytes thanks to Andrei Odegov
-2 bytes thanks to mazzy

-join($args|%{$_+$_})

Try it online!

Takes input via splatting, essentially making it an array of chars

Veskah

Posted 2019-07-31T09:57:51.833

Reputation: 3 580

2-6 bytes. – Andrei Odegov – 2019-07-31T16:10:48.827

1

what do you think about splatting? Try it online!

– mazzy – 2019-07-31T16:10:51.190

11

sed, 10 8 bytes

s/./&&/g

Try it online!

Thanks to @manatwork for -2 bytes.

Leo Tenenbaum

Posted 2019-07-31T09:57:51.833

Reputation: 2 655

4Those lengthy escaping… Better s/./&&/g. – manatwork – 2019-07-31T12:52:23.123

This replaces each/any character with the whole matched search pattern (&), in this case one character, twice via &&. – stephanmg – 2019-11-11T11:05:38.797

11

8088 Assembly, IBM PC DOS, 16 10 bytes

Assembled byte xxd dump

00000000: b401 cd21 b40e cd10 ebf6                 ...!......

Unassembled listing:

B4 01       MOV  AH, 01H        ; DOS read char from STDIN (AH=01)
CD 21       INT  21H            ; read char into AL (echoes input)
B4 0E       MOV  AH, 0EH        ; BIOS write char to console
CD 10       INT  10H            ; write char to console 
EB F6       JMP  -10            ; continue looping until break

Standalone PC DOS executable. Input from STDIN, output to console.

Interactive console input:

enter image description here

Input by pipe:

enter image description here

Original 16 byte answer:

Assembled byte xxd dump

00000000: d1ee ad8a c849 acb4 0ecd 10cd 10e2 f7c3  .....I..........

Unassembled listing:

D1 EE       SHR  SI, 1          ; point SI to DOS PSP (080H) 
AD          LODSW               ; load input length into AL 
48          DEC  AX             ; remove leading space from length counter 
8A C8       MOV  CL, AL         ; move length to loop counter 
        C_LOOP: 
AC          LODSB               ; load next char into AL 
B4 0E       MOV  AH, 0EH        ; PC BIOS tty output function 
CD 10       INT  10H            ; write char to console 
CD 10       INT  10H            ; write char to console again
E2 F7       LOOP C_LOOP         ; continue looping through chars 
C3          RET                 ; exit to DOS

Standalone PC DOS executable. Input via command line, output to console.

enter image description here

640KB

Posted 2019-07-31T09:57:51.833

Reputation: 7 149

Use XCHG AX, CX instead of MOV CL, AL to save a byte. – NieDzejkob – 2019-07-31T15:14:50.010

1@NieDzejkob, thanks! The only issue there is that LODSW is going to put the leading space (20H) from 81H into AH which will of course mess up the LOOP if that's in CH... Bummer. – 640KB – 2019-07-31T16:02:42.087

9

Haskell, 8 bytes

(<*"x2")

Try it online!

Any two-character string works in place of "x2".

xnor

Posted 2019-07-31T09:57:51.833

Reputation: 115 687

Might you be interested in tackling https://github.com/haskell/containers/issues/314 ?

– dfeuer – 2019-08-04T15:43:30.143

8

Brachylog, 2 bytes

jᵐ

Try it online!

Explanation

 ᵐ     Map on each char
j      Juxtapose the char to itself

Fatalize

Posted 2019-07-31T09:57:51.833

Reputation: 32 976

7

Cinaski

Posted 2019-07-31T09:57:51.833

Reputation: 1 588

6

APL (dzaima/APL), 2 bytesSBCS

Anonymous tacit prefix function.

2⌿

Try it online!

is "replicate" :-)

Adám

Posted 2019-07-31T09:57:51.833

Reputation: 37 779

6

Rust, 83 46 45 bytes

|x:&str|for c in x.chars(){print!("{}{0}",c)}

Try it online!

I don't like this, but it's not cheating.

wizzwizz4

Posted 2019-07-31T09:57:51.833

Reputation: 1 895

1-1 byte with print!("{}{0}",c) – NieDzejkob – 2019-12-19T16:37:44.573

6

Haskell, 15 bytes

Here (:)<*>pure takes an argument and returns a list containing this argument twice. Then >>= maps this function over every entry of a the input list (which is a string in our case) and flattens the result (a list of lists) back to a list.

(>>=(:)<*>pure)

Try it online!

flawr

Posted 2019-07-31T09:57:51.833

Reputation: 40 560

Had the same first answer, love the use of the S combinator – cole – 2019-07-31T19:04:55.583

@cole I only saw your shorter answer when I was about to submit this one - but I posted it anyway as I thought it was so elegant:) – flawr – 2019-08-01T07:47:24.243

6

J, 6 3 bytes

-3 bytes thanks to Richard Donovan

2#]

Try it online!

K (oK), 8 4 bytes

-4 bytes thanks to ngn!

{2}#

Try it online!

Galen Ivanov

Posted 2019-07-31T09:57:51.833

Reputation: 13 815

1Galen isn’t it just 2# for two bytes, as in... – Richard Donovan – 2019-07-31T18:52:09.507

12# ‘qwerty’ ===> ‘qqwweerrttyy’ – Richard Donovan – 2019-07-31T18:54:21.543

@Richard Donovan yes. It works! – Galen Ivanov – 2019-07-31T18:55:18.777

similarly in k: {2}#

– ngn – 2019-08-14T09:10:50.213

@ngn Hmm, I didn't know, apparently! Thank you! – Galen Ivanov – 2019-08-14T09:18:57.643

6

C (gcc), 40 bytes

f(s,t)char*s,*t;{while(*t++=*t++=*s++);}

Try it online!

Assumes t is a buffer which is large enough to store the output.

Probably not standard-conforming, but it works on TIO.

Leo Tenenbaum

Posted 2019-07-31T09:57:51.833

Reputation: 2 655

5

Pyth, 2 bytes

.i

Try it online!

.interleaves two copies of the input together. The input is implicit, so a 'full' version of this program would be .iQQ, where Q is the program's input.

Sok

Posted 2019-07-31T09:57:51.833

Reputation: 5 592

5

MarioLANG, 23 20 17 bytes

>,
"+
.[
.<
!-
#=

Try it online!

Unlike brainfuck, MarioLANG returns -1 on EOF, so we must increment the value read before comparing it to zero, and then decrement before printing it. This is probably the shortest answer possible in MarioLANG.

Charlie

Posted 2019-07-31T09:57:51.833

Reputation: 11 448

5

Java 8, 27 bytes

s->s.replaceAll(".","$0$0")

Try it online.

Old 31 bytes answer before the rules got changed:

s->s.replaceAll("(?s).","$0$0")

NOTE: The suggestion of @EmbodimentOfIgnorance (\n|. instead of (?s). has been reverted, since it fails if the input contains \r. Thanks for reporting to @OlivierGrégoire.

Try it online.

Explanation:

s->                             // Method with String as both parameter and return-type
  s.replaceAll("(?s).","$0$0")  //  Regex-replace all matches with the replacement
                                //  And return the changed String as result

Regex explanation:

(?s).                           // Match:
(?s)                            //  Enable DOTALL mode so newlines and carriage returns
                                //  are treated as literal
    .                           //  A single character

$0$0                            // Replacement:
$0                              //  All character(s) found in the match
  $0                            //  And again all character(s) found in the match

Kevin Cruijssen

Posted 2019-07-31T09:57:51.833

Reputation: 67 575

1(?s). can be replaced with \n|. – Embodiment of Ignorance – 2019-07-31T14:36:37.213

@EmbodimentofIgnorance Ah, of course. Thanks! :) – Kevin Cruijssen – 2019-07-31T15:22:31.193

The \n|. version doesn't work correctly with input "\r". The (?s). version works correctly with \r, though. – Olivier Grégoire – 2019-08-01T11:35:30.800

The requirement now says ASCI in range 32-126, so you can golf to 30 with @EmbodimentofIgnorance's shortcut. – Olivier Grégoire – 2019-08-02T07:47:53.683

@OlivierGrégoire well if the range is 32-126 you can golf to 27 with just . – Grimmy – 2019-08-02T09:26:14.813

@OlivierGrégoire Yeah, I saw the comments below the challenge and was waiting for the edit. And Grimy is indeed right that we can drop the \n| completely. I personally liked the older rules slightly more, but whatever. – Kevin Cruijssen – 2019-08-02T09:31:03.687

1Oops, sometimes I forget that \n is printable but not part of the ASCII printable range. – Olivier Grégoire – 2019-08-02T09:47:43.697

@OlivierGrégoire I know the feeling. ;) Same with tabs (and maybe carriage returns). Always thought the term 'printable' didn't really make sense for just the $[32,127]$ codepoint range, but whatever. – Kevin Cruijssen – 2019-08-02T10:37:34.077

5

Labyrinth, 12 bytes

",)@
" (
..:

Try it online!

I have just discovered this language so this answer may be notably improved...

Charlie

Posted 2019-07-31T09:57:51.833

Reputation: 11 448

1

Nicely done, my first thought was the same (only "," instead of "",), I've managed an eleven now - could there be a ten or better?

– Jonathan Allan – 2019-07-31T17:53:52.247

5

Stax, 2 bytes

c\

Run and debug it at staxlang.xyz!

Copy. Zip. Implicit print.

Khuldraeseth na'Barya

Posted 2019-07-31T09:57:51.833

Reputation: 2 608

5

R, 50 33 bytes

-17 bytes thanks to Giuseppe

function(a)gsub('(.)','\\1\\1',a)

Try it online!

Robert S.

Posted 2019-07-31T09:57:51.833

Reputation: 1 253

1gsub('(.)','\\1\\1',a)? – Giuseppe – 2019-07-31T15:40:46.693

I don't only check CG.SE two seconds after you post, I check all the time, haha, I should probably cut back a little. – Giuseppe – 2019-07-31T15:41:38.500

@Giuseppe No idea how that works, but it does. – Robert S. – 2019-07-31T15:42:01.850

1Oh, well gsub does regular expression replacement -- replaces a single character match (.) in capture group 1 with two copies of capture group 1 \\1\\1, for all possible matches, as opposed to sub which only does one. – Giuseppe – 2019-07-31T15:43:21.163

@Giuseppe Should this be submitted as your own answer since it is a completely different solution than what I came up with? – Robert S. – 2019-07-31T15:45:56.653

nah, I already wrote two answers. You take the rep and keep on golfing :-) – Giuseppe – 2019-07-31T15:52:14.773

5

Retina, 4 bytes


$<&

Try it online!

Matches the empty string (i.e. the position before/after each character) and inserts the string between this and the previous match (which is always exactly the previous character; except for the first match where it does nothing).

Martin Ender

Posted 2019-07-31T09:57:51.833

Reputation: 184 808

4

Perl 5 (-0777p -Mre=/s), 10 bytes

s/./$&$&/g

TIO

Nahuel Fouilleul

Posted 2019-07-31T09:57:51.833

Reputation: 5 582

4

Brain-Flak, 48 bytes

([]){{}({}<>)<>([])}{}<>([]){{}(({}<>))<>([])}<>

Try it online!

This code has two main sections. The first just reverses the string:

([]){{}({}<>)<>([])}{}<>

The second is nearly identical, it reverses the string and doubles the characters in place

([]){{}(({}<>))<>([])}{}<>

The reason we need to reverse things is that we need to touch every element of the strings in order to make the output. Since Brain-Flak uses a stack model touching each character means popping all of the elements and pushing them. Because of the FIFO manner of a stack this means each time this is done you reverse the string. The reversing issue is not present in Brain-Flueue below.

Brain-Flueue, 28 bytes

([]<>){({}[()])<>(({}))<>}<>

Try it online!

Since queues are first in last out all we need to do in Brain-Flueue is iterate through the entire string doubling every character in place. However this does make it harder to iterate through the entire stack. In Brain-Flak we could just go until the stack height is zero however with a queue, pushing something puts it on the bottom of the queue essentially losing it. Instead we use the second queue to keep track of the number of operations we need. This makes are main loop look like:

([]<>){({}[()])<>...<>}<>

With the contents being the meager

(({}))

Just for fun, both of these answers could get a lot shorter if there were no null bytes in the input (ascii value zero)

Brain-Flak, 26 bytes

{({}<>)<>}<>{(({}<>))<>}<>

Try it online!

Brain-Flueue, 14 bytes

{(({}<>))<>}<>

Try it online!

Post Rock Garf Hunter

Posted 2019-07-31T09:57:51.833

Reputation: 55 382

44 bytes handling nulls – James – 2019-07-31T15:46:57.133

4

Turing Machine But Way Worse, 475 bytes

0 0 0 1 1 0 0 
1 0 1 1 1 0 0
0 1 0 1 2 0 0
1 1 1 1 a 0 0
0 2 0 1 3 0 0
1 2 1 1 b 0 0
0 3 0 1 4 0 0
1 3 1 1 c 0 0
0 4 0 1 5 0 0
1 4 1 1 d 0 0
0 5 0 1 6 0 0
1 5 1 1 e 0 0
0 6 0 1 7 0 0
1 6 1 1 f 0 0
0 7 0 1 g 0 0
1 7 1 1 g 0 0
0 a 0 1 b 0 0
1 a 1 1 b 0 0
0 b 0 1 c 0 0
1 b 1 1 c 0 0
0 c 0 1 d 0 0
1 c 1 1 d 0 0
0 d 0 1 e 0 0
1 d 1 1 e 0 0
0 e 0 1 f 0 0
1 e 1 1 f 0 0
0 f 0 0 h 1 0
1 f 1 0 h 1 0
0 h 0 1 i 1 0
1 h 1 1 i 1 0
0 i 0 1 0 0 0
1 i 1 1 0 0 0
0 g 0 1 g 0 1
1 g 1 1 g 0 1

Trivial modification of this answer

Try it online!

MilkyWay90

Posted 2019-07-31T09:57:51.833

Reputation: 2 264

4

Labyrinth, 11 bytes

,:
"~~."
 @

Try it online!

How?

, - takes a byte from STDIN and pushes its ordinal onto the stack (0-255)
  -                                    unless EOF which pushes -1
: - duplicates the top of the stack [TOS]
~ - bitwise NOT TOS (-1 becomes 0, n becomes -n-1)
  -   4-neighbours: if TOS=0 go forward to @
  -                 if TOS<0 go left to ~
  -                 if TOS>0 go right to " (never the case)
@ - exits the program, otherwise...
~ - bitwise NOT TOS (undoes the effect of the previous ~)
. - print and discard TOS (mod 256) as an ASCII character
" - no-op
  -   We've hit a wall, turn around!
. - print and discard TOS (mod 256) as an ASCII character
~ - bitwise NOT TOS (stack starts with an infinite supply of 0s, so now TOS=-1) 
~ - bitwise NOT TOS (and now TOS=0 again)
  -   4-neighbours, but TOS=0 takes us forward to "
" - no-op
  -   ...and we're back at the starting ,
  -      facing right, with infinite 0s on the stack - just like the start

Jonathan Allan

Posted 2019-07-31T09:57:51.833

Reputation: 67 804

4

Flobnar, 11 bytes

\\@
|~
,e
:

Try it online!

This feels golfable.

Esolanging Fruit

Posted 2019-07-31T09:57:51.833

Reputation: 13 542

upvoted for name alone – Jonah – 2019-08-01T02:10:09.077

4

C# (Visual C# Interactive Compiler), 26 bytes

s=>s.SelectMany(c=>c+""+c)

Try it online!

dana

Posted 2019-07-31T09:57:51.833

Reputation: 2 541

1You could just use s=>s.Select(c=>c+""+c) instead to save 4 bytes – Zac Faragher – 2019-08-01T02:52:07.427

1I considered that, but the signature would be kind of strange, since it is converting from IEnumerable<char> to IEnumerable<string> and other answers had avoided this. – dana – 2019-08-01T03:10:26.120

Wait, this answer is actually wrong right now.. The output is a list of 2-char strings, which is neither a string nor list of chars/single-char strings. I.e. "abc" results in ["aa","bb","cc"]. The additional join in the print makes it aabbcc, but that should then be counted towards the byte-count. If ["aa","bb","cc"] would have been an acceptable output, I would have a few 1-byter solutions for my 05AB1E answer.. – Kevin Cruijssen – 2019-08-01T10:05:04.893

2@KevinCruijssen - the output is a list of characters. If you use Select you get a list of 2-character strings. SelectMany flattens each element and connects them. The output is a long list of characters. – dana – 2019-08-01T12:10:36.087

1@dana Ah ok, thanks for explaining. Then your code is indeed correct, but ZacFaragher's suggestion would give the incorrect result. Based on your response to him I thought the problem was outputting a list of single-char strings instead of actual chars, in which case you could also use single-char strings as IEnumerable<string> as both in- AND output. Didn't knew SelectMany would flatten in the process. In that case my initial upvote remains (couldn't retract it earlier anyway ;p). – Kevin Cruijssen – 2019-08-01T12:15:03.590

25 bytes – LiefdeWen – 2019-08-14T13:29:45.003

@LiefdeWen - That creates an array of 2-length strings whereas the current answer outputs an array of characters. I knot it's subtle, but in looking at the comments I think this difference makes 2-length strings invalid output – dana – 2019-08-14T13:55:23.753

@dana Oh yeah, you are right – LiefdeWen – 2019-08-15T04:41:16.387

3

QuadR, 4 bytes

.
&&

Try it online!

. replace each character

&& with itself followed by itself

Adám

Posted 2019-07-31T09:57:51.833

Reputation: 37 779

3

Keg, 11 7 6 4 3 bytes

(⑩,

Explanation

(   # Repeat length of stack times:
 ⑩  # Print without popping the top of the stack
  , # Print with popping

Try It Online!

user85052

Posted 2019-07-31T09:57:51.833

Reputation:

I'm impressed! Could not have golfed it that much! About TIO for Keg: how would I go around doing that... I know that it is to be done via the chat room, but I don't know if a direct request from someone who has never had any involvement in the room would be perceived as rude. – Lyxal – 2019-07-31T10:37:44.793

Also, how would implicit input for Keg sound? – Lyxal – 2019-07-31T10:38:13.980

3

@Jono2906 That definitely wouldn't be rude! Leaving a ping to Dennis in talk.tryitonline.net with a link to the interpreter should be enough to get Keg on tio :)

– Mr. Xcoder – 2019-07-31T12:14:34.263

@A__ Try it online!

– Lyxal – 2019-08-09T23:04:28.000

2This doesn't output anything now? – EdgyNerd – 2019-11-03T15:48:00.283

Waiting Jono 2906 to fix it... – None – 2019-11-04T00:23:35.460

Try it online! - 3 bytes – Lyxal – 2019-12-03T03:41:20.240

3

Gema, 5 characters

?=?$0

Sample run:

bash-5.0$ gema '?=?$0' <<< 'Double speak!'
DDoouubbllee  ssppeeaakk!!

Try it online!

manatwork

Posted 2019-07-31T09:57:51.833

Reputation: 17 865

3

Whitespace, 33 bytes

[N
S S N
_Create_Label_LOOP][S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   S _Read_STDIN_as_integer][T T   T   _Retrieve][S N
S _Duplicate_input][T   N
S S _Output_as_character][T N
S S _Output_as_character][N
S N
N
_Jump_to_Label_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Try it online (with raw spaces, tabs and new-lines only).

Explanation in pseudo-code:

Start LOOP:
  Character c = STDIN as character
  Print c
  Print c
  Go to next iteration of LOOP

Kevin Cruijssen

Posted 2019-07-31T09:57:51.833

Reputation: 67 575

This language is Bizzare! – AJFaraday – 2019-08-02T10:27:58.710

1

@AJFaraday :D It's perfect for some source-code and polyglot tagged challenges, though. ;) And this answer is quite straight-forward tbh. You can take a look at some of my other answers in Whitespace for harder examples.

– Kevin Cruijssen – 2019-08-02T10:42:15.330

3

T-SQL 2008, 78 bytes

DECLARE @ varchar(max)='Double speak!'

,@z int=1WHILE @z<=len(@)SELECT
@=stuff(@,@z,0,substring(@,@z,1)),@z+=2PRINT @

Try it online

t-clausen.dk

Posted 2019-07-31T09:57:51.833

Reputation: 2 874

3

Wolfram Language (Mathematica), 13 11 bytes

-2 thanks to LegionMammal978

#~Riffle~#&

Try it online!

Takes and returns an array of characters.

attinat

Posted 2019-07-31T09:57:51.833

Reputation: 3 495

I believe the more straightforward #~Riffle~#& would be a valid 11-byte solution (taking and returning a character list). – LegionMammal978 – 2019-11-03T14:51:36.373

3

Oracle SQL, 43 bytes

select regexp_replace(x,'(.)','\1\1')from t

It works with an assumption that input data is stored in a table t(x), e.g.

with t(x) as (select 'Double speak' from dual)

Dr Y Wit

Posted 2019-07-31T09:57:51.833

Reputation: 511

3

Scala, 37 bytes

def^(s:String)=s.flatMap(x=>Seq(x,x))

Try it online!

Dr Y Wit

Posted 2019-07-31T09:57:51.833

Reputation: 511

Wow, a nice one with clever use of Seq ; I was about to make one with replace but this one is like 10b shorter – V. Courtois – 2019-08-06T06:43:45.093

According to other code golf solutions in Java, Kotlin and C#, it seems to be accepted to provide just a Lambda without binding it to a name. Thus, like Kotlin's it one can make use of Scala's _, for example, _.flatMap(x=>Seq(x,x)), using only 22 chars. TIO. Of course, this is just a counting trick, which does still follow your nice approach.

– cubic lettuce – 2019-08-07T21:09:55.177

@cubic lettuce, I think those answers do not fully comply with the rules. Some time ago I got this useful recommendation https://codegolf.stackexchange.com/questions/174521/the-written-digits-sequence/174645#comment420978_174645. I would not bother with such "counting tricks"... unless it makes a scala solution shorter than any other. :)

– Dr Y Wit – 2019-08-12T13:37:24.763

... the comment you linked links further to https://codegolf.stackexchange.com/questions/3885/tips-for-golfing-in-scala , where the accepted answer suggests to use Scala's _ where possible, however, without answering the question whether this is acceptable for the outermost function definition :)

– cubic lettuce – 2019-08-13T14:39:34.617

3

Gaia, 1 byte

Z

Try it online!

Z interleaves two strings (or lists); implicitly takes the input as both arguments.

Giuseppe

Posted 2019-07-31T09:57:51.833

Reputation: 21 077

3

Factor, 32 bytes

: f ( s -- s ) dup zip "" join ;

Try it online!

Galen Ivanov

Posted 2019-07-31T09:57:51.833

Reputation: 13 815

3

Shakespeare Programming Language, 238 164 bytes

,.Ajax,.Puck,.Act I:.Scene I:.[Enter Ajax and Puck]Ajax:Open mind.Let usScene V.Scene V:.Ajax:Be you better than I?If sospeak thy.Speak thy.Open mind.Let usScene V.

Try it online!

Boy, golfing in SPL does seem ugly...

  • Lots of bytes saved after Veskah pointed me to the SPL golfing tips. :-)

Charlie

Posted 2019-07-31T09:57:51.833

Reputation: 11 448

2Gotta use Ajax and Puck. You can also omit a ton of non-essential words for big savings, though it does lose some of the SPL charm when you do. – Veskah – 2019-07-31T14:11:53.167

An alternative algorithm can be much shorter.

– NieDzejkob – 2019-07-31T14:20:59.523

@NieDzejkob Nice one, I tried something similar but the interpreter said that my characters were already on scene when I tried to loop, so I had to introduce two scenes. – Charlie – 2019-07-31T14:50:21.137

@Charlie I'm also using two scenes. I'm about to integrate a -3 byte improvement from Jo King that removes the scene, though. – NieDzejkob – 2019-07-31T15:12:17.390

You don't need the first explicit scene transition, and I'm not sure what the conditional is about, since you terminate with an error anyway? You only do if so for the first output, but not the second, nor the scene transition – Jo King – 2019-07-31T22:09:25.997

@JoKing yes, I noticed that, but if I keep on golfing my answer will be the same as NieDzejkob's... – Charlie – 2019-08-01T04:29:34.963

3

Z80Golf, 10 bytes

00000000: cd03 8030 0176 ffff 18f6                 ...0.v....

Try it online!

Corresponding assembly:

start:
    call $8003 ; input
    jr nc, no_halt
    halt
no_halt:
    rst $38 ; nop-slide to $8000 - output
    rst $38
    jr start

NieDzejkob

Posted 2019-07-31T09:57:51.833

Reputation: 4 630

3

Triangularity, 17 bytes

..)..
.IMD.
+}""J

Try it online!

Mr. Xcoder

Posted 2019-07-31T09:57:51.833

Reputation: 39 774

3

Befunge-93, 8 bytes

~:1+%:,,

Try it online!

For each character in input, outputs c%(c+1) as a character twice. This makes the program calculate -1%0 on EOF (-1), which terminates it.

negative seven

Posted 2019-07-31T09:57:51.833

Reputation: 1 931

3

Husk, 3 bytes

ṁR2

Try it online!

Esolanging Fruit

Posted 2019-07-31T09:57:51.833

Reputation: 13 542

3

!@#$%^&*()_+, 12 bytes

*^(_^_!@@*^)

Try it online! If programs could terminate with an error, *(!@@*) works for 7 bytes.

Explanation

*^(_^_!@@*^)
*^                 take input, add 1
  (        )       loop until top of stack is 0
   _^_             subtract 1
      !            duplicate
       @@          output twice
         *^        take input, add 1

Conor O'Brien

Posted 2019-07-31T09:57:51.833

Reputation: 36 228

How do you pronounce !@#$%^&*()_+ ?? – roblogic – 2019-08-01T20:45:52.493

2@roblogic There are two canonical pronunciations. (1) "ek-nid-puc-ay-al-rulp" (2) "dang" – Conor O'Brien – 2019-08-01T20:49:01.353

3

Zsh, 29 bytes

s=(${(s::)1})
<<<${(j::)s:^s}

Try it online!

I love parameter expansion flags:

s=(${(s::)1})
   ${     1}    # first argument
     (s::)      # split into characters: (s:foo:) splits on the string "foo"
s=(         )   # capture as array $s

<<<${(j::)s:^s}
   ${     s:^s} # zip array s with array s
     (j::)      # join on empty string (opposite of s::)
<<<             # print to stdout

Honorable mention, which would be 27 bytes... if not for the required 20 extra bytes to setopt extendedglob:

setopt extendedglob
<<<${1//(#m)?/$MATCH$MATCH}

This is basically the same as sed 's/./&&/g'<<<$1, but with builtins only.

Try it online!

GammaFunction

Posted 2019-07-31T09:57:51.833

Reputation: 2 838

1I was all set up to try zsh but then you made this! – roblogic – 2019-08-02T00:18:08.270

3

Lua, 32 31 bytes

print(((...):gsub('.','%0%0')))

Try it online!

Full program, take input as command line argument. Explanation is fairly trivial:

print(             -- Print result
    (              -- Drop second result (count of replacements, length of string for us)
        (...)      -- Take first cmd argument
        :gsub(     -- Do replacement:
            '.',   -- Take each character
            '%0%0' -- and replace it with itself (whole match) repeated twice
        )

    )
)
```

val says Reinstate Monica

Posted 2019-07-31T09:57:51.833

Reputation: 409

3

C (gcc), 62 41 bytes

f(char*a){for(;putchar(putchar(*a++)););}

Try it online!

This takes in input as the first arg, and outputs a NULL-terminated string to stdout. Not sure if the NULLs are a big deal. If you read the string properly, you'll stop after the first one ;)

Original without using a footer

AI221

Posted 2019-07-31T09:57:51.833

Reputation: 61

3

C (gcc), 57 56 bytes

Thanks to ceilingcat and gastropher for the suggestions.

The string is modified in-place, so the buffer holding the string needs to be big enough first.

i;f(char*s){for(i=strlen(s)+1;i--;s[i-~i]=s[i*2]=s[i]);}

Try it online!

C version with allocated string, 73 71 bytes

If the string buffer can't be assumed to be big enough (or writable), this version allocates a buffer to return.

f(s,t,u)char*s,*t;{for(u=t=malloc(strlen(s)*3);*t++=*s;*t++=*s++);s=u;}

Try it online!

ErikF

Posted 2019-07-31T09:57:51.833

Reputation: 2 149

Far as I could tell, there is no rule against wastefulness, so you could do malloc(strlen(s)*3) in the allocated string version to save two bytes. – gastropner – 2019-08-20T02:42:03.103

You can save 13 bytes by using recursion in your in place modified version: x;f(char*s){x++;*s&&f(s+1);s[--x]=s[x]=*s;} – xibu – 2019-12-01T19:39:12.863

3

Swift 5, 30 bytes

thanks to @Mr.Xcoder for -14 bytes

{a in a.flatMap{"\($0)\($0)"}}

Try it online!

Tiziano Coroneo

Posted 2019-07-31T09:57:51.833

Reputation: 141

Welcome to PPCG, nice answer! You can drop let x= and put it in the header for -6 bytes. – Mr. Xcoder – 2019-08-01T08:43:56.327

@Mr.Xcoder like this? Try it online!

– Tiziano Coroneo – 2019-08-01T09:31:07.170

2Yes, precisely. – Mr. Xcoder – 2019-08-01T09:31:44.750

3

PHP, 37 32 bytes

-2 bytes by removing PHP start tag <? and adding it in header per gwaugh's suggestion

-3 bytes thanks to great idea of gwaugh and eliminating the need for !='' check

for(;$l.=$l=$argn[$i++];)echo$l;

Try it online!

Night2

Posted 2019-07-31T09:57:51.833

Reputation: 5 484

1

You don't need to include the opening <? in your byte count (-2 bytes). You can also -3 more bytes this way for 32 bytes.

– 640KB – 2019-08-03T19:59:04.677

@gwaugh Thanks for the great idea, edited. – Night2 – 2019-08-05T04:07:53.630

I don't believe you can omit the ending semicolon. As a standalone, it must still be legal PHP and run as php -r "echo 'foo';". – 640KB – 2019-08-05T16:54:01.967

@gwaugh I assumed that since we can remove the starting tag, same goes for the end tag. Added semicolon and 1 byte back. – Night2 – 2019-08-06T06:06:12.773

1

The semicolon is part of the preceeding statement, so is required syntax. There is nothing to prohibit from using a close tag ?> as long as it's included in your score. If you do, then yes it's valid to omit the last semicolon, however the general consensus is you can't use a close tag unless you have a corresponding open tag. Occasionally this is helpful: example because in that case it's shorter than an echo.

– 640KB – 2019-08-06T15:06:24.320

3

Ook!, 48 bytes

Ook.Ook!Ook!Ook?Ook!Ook.Ook!Ook.Ook.Ook!Ook?Ook!

This is just a port of my brainfuck answer. Unfortunately there is no support for Ook! on TIO, but you can use this online interpreter.

Charlie

Posted 2019-07-31T09:57:51.833

Reputation: 11 448

3

K (oK), 5 bytes

Solution:

,/2#'

Try it online!

Explanation:

,/2#' / the solution
  2#' / 2 take (#) each
,/    / flatten

streetster

Posted 2019-07-31T09:57:51.833

Reputation: 3 635

1{2}# also works – ngn – 2019-08-05T17:26:50.363

Will update once I'm off mobile, can you explain how/why this one works? Why doesn't the lambda just return 2? – streetster – 2019-08-05T20:01:41.070

m#l is filter (m monad, l list) - equivalent to l@&m'l – ngn – 2019-08-06T06:20:28.393

3

GolfScript, 7 6 bytes

1/{.}/

Try it online!

my first golfscript program! Other people's explanations on here were super helpful for me to refer to so I'll type mine out even though its pretty short

1/           split top of stack into groups of size 1
  { }/      execute code inside braces for each element
   .        copy the top item of the stack

Kenneth Taylor

Posted 2019-07-31T09:57:51.833

Reputation: 183

doesn't this beat other golfscript answers? nicely done – V. Courtois – 2019-08-06T06:46:36.357

3

Kotlin, 44 bytes

{s:String->s.map{"$it$it"}.joinToString("")}

Try it online!

Brojowski

Posted 2019-07-31T09:57:51.833

Reputation: 141

3

MathGolf, 1 byte

^

Try it online!

Same as the Jelly answer, zip works on a character level for strings. Implicitly pops the input twice, and zips it with itself to produce a string. The first idea I had was m_ (map each character to duplicate), which produces identical output.

maxb

Posted 2019-07-31T09:57:51.833

Reputation: 5 754

3

Gaia, 4 3 bytes

:¦$

Basically just maps the duplicate instruction to the input string, then turns the returned list into a string

Edit: turns out there was already a 1 byte answer in Gaia for this question that I missed, so my solution isn't that great

How it works

:   Duplicate
¦   Map to each character of the input string
$   Convert the returned list to a string
Auto outputs stack

Try it Online!

EdgyNerd

Posted 2019-07-31T09:57:51.833

Reputation: 1 106

You don't need @ because the interpreter will implicitly push values onto the stack if needed, which is why Z works just fine.

– Giuseppe – 2019-08-13T10:57:01.983

Oh wow, I didn't realise that, my solution is really sub-optimal – EdgyNerd – 2019-08-13T12:45:20.457

Well, I've been golfing in Gaia a bit; this is still quite good! – Giuseppe – 2019-08-13T12:56:10.880

there's also 2&. – Giuseppe – 2019-08-13T17:12:11.530

reading through the docs for Gaia is annoying, especially since the interpreter is rather buggy. – Giuseppe – 2019-08-13T17:12:37.183

3

Poetic, 46 49 bytes

+3 bytes to account for inputs that are longer than the tape will allow (unlikely, but possible).

enduring a tragedy,knowing a way i am,troubles me

Try it online!

Poetic is an esolang I created in 2018 for a class project. It's basically brainfuck with word-lengths instead of symbols.

The point of the language is to allow for programs to be written in free-verse poetry. I encourage you all to try it out sometime!

JosiahRyanW

Posted 2019-07-31T09:57:51.833

Reputation: 2 600

3

Taxi, 390 342 bytes

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.[A]Go to Chop Suey:n 1 r 1 l 4 r 1 l.Switch to plan B waiting.Pickup a passenger going to Cyclone.Go to Zoom Zoom:n 1 l 3 r.Go to Cyclone:w.Pickup a passenger going to Post Office.Pickup a passenger going to Post Office.Go to Post Office:s 1 l 2 r 1 l.Switch to plan A.[B]

Try it online!

Explanation/Ungolfed

    [Take input string]
Go to Post Office: west 1st left, 1st right, 1st left.
Pickup a passenger going to Chop Suey.

[loop]
    [If string as a passenger, split it]
Go to Chop Suey: north 1st right, 1st left, 4th right, 1st left.
    [At the end of the string, end the program]
Switch to plan end_loop if noone is waiting.
        ["if noone is" apparently optional here]
    [Duplicate first char left]
Pickup a passenger going to Cyclone.
Go to Zoom Zoom: north 1st left, 3rd right.
Go to Cyclone: west.
    [Print char twice]
Pickup a passenger going to the Post Office.
Pickup another passenger going to the Post Office.
Go to the Post Office: south 1st left, 2nd right, 1st left.
Switch to plan loop.

[end_loop]
    [Program crashes, Taxi not in Garage at end of the week]

Comment

It does not even matter whether we tank at Zoom Zoom or Fueler Up, both were 390 bytes and now are 342 bytes:

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.[A]Go to Fueler Up:n 1 r 1 l.Go to Chop Suey:n 3 r 1 l.Switch to plan B waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Post Office.Pickup a passenger going to Post Office.Go to Post Office:s 1 l 2 r 1 l.Switch to plan A.[B]

Try it online!

Anderium

Posted 2019-07-31T09:57:51.833

Reputation: 81

You can save four bytes by removing the quotation marks in the "Switch to plan" commands. – Dorian – 2019-11-12T10:12:59.677

3

naz, 34 bytes

2a2x1v1x1f0a0x1x2f1r3x1v1e2o2f0x2f

Works for any input file terminated with the control character STX (U+0002).

Explanation (with 0x commands removed)

2a2x1v           # Set variable 1 equal to 2
1x1f0a           # Function 1
                 # Add 0 to the register
1x2f1r3x1v1e2o2f # Function 2
                 # Read a byte of input and jump to function 1 if it equals variable 1
                 # Otherwise, output twice and jump back to the start of function 2
2f               # Call function 2

sporeball

Posted 2019-07-31T09:57:51.833

Reputation: 461

3

Fortran (GFortran), 71 65 bytes

character(99)a
read*,a
print*,(a(i:i),a(i:i),i=1,len_trim(a))
end

Try it online!

Saved 6 bytes thanks to @roblogic pointing out that if the input is quoted it can be read as list-directed.

If we don't care about extra whitespace:

Fortran (GFortran), 56 bytes

character(99)a
read*,a
print*,(a(i:i),a(i:i),i=1,99)
end

Try it online!

DeathIncarnate

Posted 2019-07-31T09:57:51.833

Reputation: 916

Nice, I tried to use "proper" syntax for 100 bytes. https://codegolf.stackexchange.com/a/189152/15940

– roblogic – 2020-01-19T09:30:20.207

1@roblogic I saw, that's what inspired me to beat it. To me, there's nothing wrong with implicit loops in very rare situations (Array assignment and printing), but in golf, anything goes. – DeathIncarnate – 2020-01-19T10:10:57.820

the 56-byte solution will work correctly if you assume the input string is quoted. example

– roblogic – 2020-01-19T10:34:47.197

@roblogic Still prints out excess whitespace, but saves bytes on the main one. – DeathIncarnate – 2020-01-19T10:56:53.780

2

Retina 0.8.2, 6 bytes

.
$&$&

Try it online! Not guaranteed to work with unprintable characters. Previous 8-byte version worked with newlines:

s`.
$&$&

Try it online!

Neil

Posted 2019-07-31T09:57:51.833

Reputation: 95 035

You can remove the s` now that the rules got changed. – Kevin Cruijssen – 2019-08-02T09:30:09.220

@KevinCruijssen Thanks! – Neil – 2019-08-02T09:46:08.767

2

VDM-SL, 28 bytes

f(a)==conc[[x,x]|x in seq a]

Distributed enumeration of the sequence containing sequences of length 2 of repeated elements of a.

enter image description here

Expired Data

Posted 2019-07-31T09:57:51.833

Reputation: 3 129

I don't think the output of your first solution is valid. – Shaggy – 2019-07-31T15:09:06.170

@Shaggy maybe, when I posted it there were other answers with similar output. I'll remove the first one – Expired Data – 2019-07-31T15:15:30.797

If you spot any others, leave them a similar comment ;) – Shaggy – 2019-07-31T17:10:48.300

2

Standard ML (MLton), 35 bytes

String.translate(fn c=>str c^str c)

Try it online!

The function translate from the String library has the following type:

translate : (char -> string) -> string -> string

Thus, given a function that takes a char c, converts it to a singleton string twice with str c and concatenates both with ^, we get the required functionality.

Laikoni

Posted 2019-07-31T09:57:51.833

Reputation: 23 676

2

Perl 6, 33 bytes

(@*ARGS[0].comb Xx 2).join.say

Comb splits our string into an array. The X meta operator applies the operator to it's right in a cross product fashion. So with the string "Double" it's doing ("D"x2, "o"x2, etc). Then we join the result and say it to print (with a newline).

Scimon Proctor

Posted 2019-07-31T09:57:51.833

Reputation: 131

2

Perl 6, 13 11 bytes

{S:g{.}x=2}

Try it online!

Anonymous code block that takes a string and returns a string by replacing each character with twice of itself.

Jo King

Posted 2019-07-31T09:57:51.833

Reputation: 38 234

2

Japt -m, 1 byte

²

Try it online

Oliver

Posted 2019-07-31T09:57:51.833

Reputation: 7 160

Was about to hit "Post" on my identical solution when the page refreshed with yours! – Shaggy – 2019-07-31T12:21:41.070

@Shaggy I knew this would be a race against you :-P – Oliver – 2019-07-31T12:22:13.753

1A race against everyone, nearly, on a challenge this trivial! Posted a 2 byte solution anyway. – Shaggy – 2019-07-31T12:23:40.753

2

Japt, 2 bytes

Oliver beat me to the straightforward, 1 byte solution.

íU

Try it

Interleaves the input with itself.

Shaggy

Posted 2019-07-31T09:57:51.833

Reputation: 24 623

2

jq (-Rrj), 12 characters

(./"")[]|.+.

Sample run:

bash-5.0$ jq -Rrj '(./"")[]|.+.' <<< 'D0uB!e'
DD00uuBB!!ee

Try it online!

manatwork

Posted 2019-07-31T09:57:51.833

Reputation: 17 865

2

Red, 43 bytes

func[s][t:""foreach c s[t: rejoin[t c c]]t]

Try it online!

Galen Ivanov

Posted 2019-07-31T09:57:51.833

Reputation: 13 815

2

Bash, 58 39 bytes

Using only shell builtins, no fancy parsers like sed.

58 bytes: Try it online

a="$*";for((i=0;i<${#a};i++)){ x=${a:i:1};echo -n "$x$x";}

47 bytes: (via primo)

for((;i<${#1};)){ x=${1:i++:1};echo -n "$x$x";}

39 bytes: (by manatwork). Try it online

while read -N1 c;do echo -n "$c$c";done

roblogic

Posted 2019-07-31T09:57:51.833

Reputation: 554

2Does not double % characters. – NieDzejkob – 2019-07-31T15:23:42.977

Good catch, fixed now (replaced printf with echo -n) – roblogic – 2019-07-31T15:42:31.673

1No need to reassign $*, just use $1. Initializing i=0 is unnecessary. i++ can be moved to x=${1:i++:1}. – primo – 2019-07-31T16:49:43.810

1

A traditional read in while would be shorter and still using only Bash's own staff: Try it online!.

– manatwork – 2019-07-31T17:33:11.520

2

C# (Visual C# Interactive Compiler) with Regex-flag, 24 bytes

: /u:System.Text.RegularExpressions.Regex (flag is not in the header, so it won't mess up the leader-board)

Port of my Java 8 answer, so look there for an explanation.

s=>Replace(s,".","$0$0")

Try it online.

Kevin Cruijssen

Posted 2019-07-31T09:57:51.833

Reputation: 67 575

Anything we can do to make the flag text in the header shorter? It makes the language name column in the leader-board pretty wide. (maybe "C# (Visual C# Interactive Compiler) with /u:...* flag, 28 bytes" and a * /u:System.Text.RegularExpressions.Regex in the body?) – Jonathan Allan – 2019-08-01T12:29:37.350

1@JonathanAllan I've changed it. Will have to wait a few minutes before the API-date is updated to see if it works. EDIT: works. It's better readable now. ;) – Kevin Cruijssen – 2019-08-01T12:39:33.293

2

Forth (gforth), 40 bytes

: x 0 ?do dup c@ dup emit emit 1+ loop ;

Try it online!

A byte can be saved by removing the ?, but that will break the handling of zero-length input.

NieDzejkob

Posted 2019-07-31T09:57:51.833

Reputation: 4 630

2

CJam, 3 bytes

q:_

Try it online!

Esolanging Fruit

Posted 2019-07-31T09:57:51.833

Reputation: 13 542

2

Pip, 17 16 13 bytes

Fi,#a{L2Oa@i}

Try it online!

Kenneth Taylor

Posted 2019-07-31T09:57:51.833

Reputation: 183

(belatedly) You can save two more bytes by getting rid of the curly braces. – DLosc – 2019-12-21T09:00:55.537

2

J, 2 bytes

2#

The verb "#", or "copy", copies its right argument the number of times specified by the left argument where the left argument is greater than or equal to zero and is either a single number or a vector of numbers of the same length as the first axis of the right argument. So, we can copy things "zero" times to remove them:

   1 0 1 0 # 1 2 3 4

returns 1 3.

Try it online: https://tio.run/##y/r//39qcka@gpGyukt@aVJOqkJxQWpitqI6138A

DevonMcC

Posted 2019-07-31T09:57:51.833

Reputation: 79

5Snippets aren't allowed. You solution needs to be assignable to a variable. So eg 2 # ], Galen's answer, is allowable because you can write f=. 2#], but you cannot write f=.2# – Jonah – 2019-08-01T02:08:59.967

2

><>, 9 bytes

i::0(?;oo

Try it online! I'm reasonably confident that this is optimal (barring solutions which terminate through errors; i:oo would be such a solution.)

Explanation

i::0(?;oo
i             takes one character of input      [c]
 ::           duplicates it twices              [c, c, c]
   0(?        if it's less than 0 (no input)    [c, c]
      ;       terminate
       oo     output twice                      []
              implicitly wrap to the beginning

Conor O'Brien

Posted 2019-07-31T09:57:51.833

Reputation: 36 228

1If you can start with input on the stack (IIRC a command line option for one implementation), then you could do :oo for a solution with an error and l?!;:oo for a solution without. These are not tested, but I’m pretty sure they’re right. – cole – 2019-07-31T19:11:07.180

2

Minkolang v.0.15, 7 bytes

od?.dOO

Try it here!

Explanation

od?.dOO
o            take one character of input
 d           duplicate top of stack
  ?.         terminate if its 0
    dOO      duplicate and output twice

Conor O'Brien

Posted 2019-07-31T09:57:51.833

Reputation: 36 228

2

8086/8088 machine code, 9 bytes

I couldn't resist.

ac       lodsb        Read DS:[SI] into AL, then increment SI.
aa       stosb        Write AL into ES:[DI], then increment DI.
3c 00    cmp al, 0    Is AL = 0?
74 03    je +5        If so, jump to the end of this loop.
aa       stosb        Write AL into ES:[DI], then increment DI.
eb f7    jmp -7       Jump to the beginning of this loop.

Assumptions:

  • The input string is a null-terminated string of bytes located at DS:SI.
  • There is an output string buffer located at ES:DI.
  • The output string buffer is large enough to hold the resulting string.
  • It's not necessary to tell the calling code the location of the output string buffer. If it is, add 2 bytes: 57 (push di) at the beginning and 5f (pop di) at the end. This assumes that the stack has 2 bytes free.
  • This code will be placed inline, so it's unnecessary to use an instruction to return. If this is false, add 1 byte: c3 (ret) at the end (after the 5f, if applicable).

Tanner Swett

Posted 2019-07-31T09:57:51.833

Reputation: 531

2Or 7 bytes with just: lodsb / stosb / stosb / cmp al, 0 / jne -7 It will give you two 0's at the end of the string, but can't see how that's not allowed since you're writing to a "large enough" buffer and will still be null terminated. – 640KB – 2019-08-01T18:40:28.173

2Or 6 bytes by combining the two ideas: lodsb / stosb / stosb / dec ax / jns -6 – 640KB – 2019-08-01T18:43:40.353

The question wording is pretty clear: It will modify this string. Not return a copy, so asking the caller to pass a 2nd output arg is definitely bending the rules. I asked for clarification on this. re: omitting the ret: it doesn't say "function" but it does say "return" instead of just "produce". To me that implies function, not inline block.

– Peter Cordes – 2019-08-03T01:52:42.850

@gwaugh: dec ax only works if AH was known to be zero ahead of that. That would cost an extra 2-byte instruction ahead of the loop to zero AH or AX. You can't justify offloading that setup of a tmp reg to the "caller" in code-golf. dec al wouldn't be safe and is 2 bytes anyway so we might as well just use cmp. – Peter Cordes – 2019-08-03T02:01:43.280

Anyway, to loop backwards I was thinking std then a loop like lodsb/2xstosb/loop/cld (with the caller passing a length in CX). Although we probably need add si, cx and add di, cx first if the caller passes pointers to the start of the buffers. lea di, [esi + ecx*2] costs 4 bytes (address-size prefix + SIB) so it's the same as 2x add di, cx. I don't think there's a compact way to broadcast-load so we could do word stores. 32-bit mode for AVX2 vpbroadcastb xmm0, [esi] costs at least a 3-byte VEX prefix + opcode + ModRM.

– Peter Cordes – 2019-08-03T02:07:17.067

@gwaugh: you only get to assume regs are in OS-initialized states if you're writing a complete program!! If you assume AX=0, you also have to assume that SI and DI are zero, not already pointing to buffers. re: ASCII: the question is telling us that out of the entire ASCII character set (which you can see at http://asciitable.com/), the string will only contain printable characters, not control chars or NUL (\0). And not UTF-8 or any other multi-byte or variable-length encoding. Anyway yes, this would allow dec al / jns but that's not smaller than test al,al.

– Peter Cordes – 2019-08-03T02:42:32.527

@PeterCordes there was quite a spirited debate in the comments earlier about whether the challenge required handling ASCII 0-127 or 32-126. I was only saying that if the requirement did include handling ASCII NUL (\0) then technically this solution wouldn't work because it will end the string at \0. I believe the 32-126 won out, (though I'd have preferred to see that stated more explicitly). – 640KB – 2019-08-03T18:00:08.077

2

Starry, 14 bytes

` , + + + . .'

Try it online!

Luis Mendo

Posted 2019-07-31T09:57:51.833

Reputation: 87 464

2

33, 8 bytes

P[ktppP]

Try it online! Or not. How do you get a language on TIO?

The input string has to be null-terminated.

Explanation:

P     P  | Get input character
 [     ] | While it isn't a null character:
  kt     | - Put it in the string register
    pp   | - Print it twice

TheOnlyMrCat

Posted 2019-07-31T09:57:51.833

Reputation: 1 079

You request to have the language added to TIO at https://chat.stackexchange.com/rooms/44255/talk-tryitonline-net. Thats what I'm doing at least (with my own language that is).

– Lyxal – 2019-08-01T09:22:13.000

2

Java (OpenJDK 8), 88 87 bytes

g->{String d ="";for(int i=0;i<g.length();){d+=""+g.charAt(i)+g.charAt(i++);}return d;}

Try it online!

Ungolfed:

g->{
    String d ="";
    for (int i=0;i<g.length();) {
        d+=""g.charAt(i)+g.charAt(i++);
    }
return d;
};

I'm sure there's way to shorten it, at least it was my first attempt in PPCG.

-1 for @manatwork

CuttingChipset

Posted 2019-07-31T09:57:51.833

Reputation: 99

Is shorter to force the casting (?) than to use 2 separate assignments; you can move the incrementation from for's 3rd argument to i's last usage: d+=""+g.charAt(i)+g.charAt(i++); – manatwork – 2019-08-01T11:31:48.257

@manatwork Oh, okay. Done – CuttingChipset – 2019-08-01T11:52:54.027

448 – Grimmy – 2019-08-01T11:55:16.813

@CuttingChipset, actually the point of using a single assignment was to be able to remove the for block's braces. But with Grimy's suggestion, now that's meaningless. – manatwork – 2019-08-01T12:27:00.487

@manatwork but can I put his suggestion into the answer or what? It looks diametrically different than it is currently? – CuttingChipset – 2019-08-01T12:46:20.320

Well, that's up to you. Is frequently a dilemma whether to incorporate a radically different suggestion. We have no rule for that. Sometimes we keep the older solutions too at the bottom of answer, so they stay open for further discussions but are not scored. – manatwork – 2019-08-01T12:57:46.400

If you want to use a similar answer to yours, check this: g->{var d="";for(char i=0,c;i<g.length();d+=c)d+=c=g.charAt(i++);return d;}

– Olivier Grégoire – 2019-08-02T08:34:17.847

@Grimy 45 bytes by updating to Java 10 and using it's var.

– Olivier Grégoire – 2019-08-02T08:35:25.290

@OlivierGrégoire You're link is incorrect, here the one you meant to link probably.

– Kevin Cruijssen – 2019-08-02T10:44:14.140

@KevinCruijssen Yes, that's the one. Sorry for the mix up – Olivier Grégoire – 2019-08-02T10:55:52.663

2

x86 machine code, 6 bytes

f:
  AC       LODSB
  AA       STOSB
  AA       STOSB
  E2 FB    LOOP  f
  C3       RET

Takes address of input string in SI, length of input string in CX, address of output string in DI. Should work in 16, 32 and 64-bit mode.

Try it online!

nwellnhof

Posted 2019-07-31T09:57:51.833

Reputation: 10 037

In 16-bit mode with far pointers the input string is in DS:SI and the output is in ES:DI of course. – Neil – 2019-08-02T09:51:46.007

The question specifies modifying a string (which implies in-place). So you need to work from the end of the string backwards to not overwrite chars you haven't read yet. I asked on the question for clarification. See also discussion on the 8086 machine-code answer.

– Peter Cordes – 2019-08-03T02:46:07.177

2

Bash, 72 bytes

s=$1;e(){ echo -n "${s:$i:1}";};for ((i=0;i<${#s};i++));do e;e;done;echo

If you don't have a bash terminal somewhere, this should work.

Aaron R.

Posted 2019-07-31T09:57:51.833

Reputation: 121

1

Nice try but I beat you to it.. :) https://codegolf.stackexchange.com/a/189043/15940.

– roblogic – 2019-08-01T23:46:30.433

1Yeah, totally :) – Aaron R. – 2019-08-05T19:04:01.393

2

PHP, 59 bytes

-1 bytes by @manatwork

function($g){foreach(str_split($g)as$v)$e.=$v.$v;return$e;}

Try it online!

Full program , 44 bytes

foreach(str_split(readline())as$v)echo$v.$v;

Try it online!

Micio Informatico

Posted 2019-07-31T09:57:51.833

Reputation: 53

No need for the braces around foreach's block. – manatwork – 2019-08-02T10:28:48.970

If you are submitting as a function you do have to include the function declaration (anonymous is fine) in your byte count: 65 bytes.

– 640KB – 2019-08-04T17:27:04.240

Though errors and notices are fine so you don't really need to initialize $e: 59 bytes.

– 640KB – 2019-08-04T17:30:06.467

Oh, welcome to PPCG by the way! – 640KB – 2019-08-04T17:31:50.430

Thanks, I'm fixing my answer – Micio Informatico – 2019-08-04T17:33:25.270

If you don't mind outputting the STDOUT instead,you can use echo instead of return – Jo King – 2019-08-06T04:17:50.153

I added a full program – Micio Informatico – 2019-08-06T14:15:56.913

2

Fortran (GFortran), 100 bytes

Another demonstration of fortran's concise and elegant string handling capabilities... not!!

Summary: declare S as a 99 character string. read S in string format '(A)'. iterate over the trimmed string length. print the i'th character a couple of times without a newline (TIL).

Try it Online!

character(99)S;read(*,'(A)')S;do i=1,len_trim(S)
write(*,'(A)',advance="no")S(i:i)//S(i:i);enddo;end

roblogic

Posted 2019-07-31T09:57:51.833

Reputation: 554

2

Twig, 66 bytes

This is just a simple "split, loop, output twice".
Splitting by 0 on a string is similar to splitting by '' (empty string).

{%macro a(s)%}{%for c in s|split(0)%}{{c~c}}{%endfor%}{%endmacro%}

You can try it on https://twigfiddle.com/ldxe0c.

Ismael Miguel

Posted 2019-07-31T09:57:51.833

Reputation: 6 797

2

Matlab >= r2015a, 16 bytes

@(x)repelem(x,2)

Credits to Giuseppe

Note: I haven't found an online interpreter for MATLAB; this answer correctly works with MATLAB r2015a.

Matlab <= r2014b, 23 bytes

@(x)char(kron(x,[1,1]))

Note: I haven't found an online interpreter for MATLAB; this answer correctly works with MATLAB r2014b.

PieCot

Posted 2019-07-31T09:57:51.833

Reputation: 1 039

2

Octave, 32 25 bytes

@(x)char(kron(x+0,[1,1]))

Try it online!

-7 bytes thanks to Giuseppe

PieCot

Posted 2019-07-31T09:57:51.833

Reputation: 1 039

2

Cubix, 9 bytes

oU;?Av/@o

Try it online!

Mapped onto a cube

    o U
    ; ?
A v / @ o . . .
. . . . . . . .
    . .
    . .

Watch it run

  • A Put all the input onto the stack
  • v Redirect around the cube and start of the print loop
  • o? Output the character for the stack value and test value
  • @ If test is negative (EOI), halt
  • Uo;/ If test is positive, u-turn to the left, output character again, pop from stack and reflect onto the start of the print loop.

MickyT

Posted 2019-07-31T09:57:51.833

Reputation: 11 735

2

Pepe, 19 bytes

REEerEErReEeReEeree

Try it online!

Explanation:

REEe # Input as str -> (R)
rEE # Create loop labelled 0 -> (r)
  rReEe # Output as char -> (R)
        # r flag: don't pop
  ReEe # Output as char and pop -> (R)
ree # Loop while (R) != 0

u_ndefined

Posted 2019-07-31T09:57:51.833

Reputation: 1 253

2

K (ngn/k), 5 bytes

,/2#'

Try it online!


the above is an expression that will take (#) 2 copies of each (') letter and return a list where each element is a 2-char list, e.g.

("DD";"oo";"uu";"bb";"ll";"ee";"  ";"ss";"pp";"ee";"aa";"kk";"!!")

,/ is "join over", and flattens the list. we read the expression as "join over 2 take each string". with the string passed right-side we get:

  ,/2#'"Double speak!"
"DDoouubbllee  ssppeeaakk!!"

scrawl

Posted 2019-07-31T09:57:51.833

Reputation: 1 079

{2}# works too. see other answers – ngn – 2019-08-20T15:18:00.923

2

Forth (gforth), 39 bytes

: f bounds ?do i 1 type i 1 type loop ;

Try it online!

Beats NieDzejkob's submission by one byte. If we don't care empty strings, we can safely remove the ? in ?do, making it 38 bytes.

A function that takes a string in the standard representation (addr, length), and prints the result to the console.

How it works

gforth documentation about bounds

: f ( addr len -- )
  bounds ?do        \ Iterate through char addresses..
    i 1 type        \   Print one char at the address
    i 1 type        \   One more time
  loop ;            \ End loop

Bubbler

Posted 2019-07-31T09:57:51.833

Reputation: 16 616

2

Backhand, 5 bytes

i}o: 

Try it online!

(note the trailing space) This should be the optimal answer, since all of io: are needed, 4 bytes needs at two movement modifiers to avoid getting stuck in two instruction loops, and no three byte permutation works.

Explanation:

i       Input
   :    Dupe
  o     Output
 }      Move back to output
  o     Output
   :    Unnecessary dupe
i       Beginning of loop again

Of course, for a suboptimal but ironic answer you could do:

vvii::oooo22jj

Try it online!

Which doubles up on every character.

Jo King

Posted 2019-07-31T09:57:51.833

Reputation: 38 234

2

SWI-Prolog, 87 bytes

I did not see any Prolog attempt, so I tried to make one.

d([A|X],[A,A|Y]):-d(X,Y). d([],[]). p(X,W):-string_codes(X,Y),d(Y,Z),string_codes(W,Z).

The predicate to be called is p:

?- p("Hello world!", X)

It produces (in SWI-Prolog online interpreter):

X = "HHeelllloo wwoorrlldd!!";

Explanation

The code uses two different predicates: the first one (d) works with a list and duplicates every element in it.

d([A|X], [A,A|Y]) :- d(X, Y).
d([],[]).

As most of Prolog's predicates, it uses recursion to implement iteration over elements: the first line is the recursive step, while the second is the base step. Duplication is obtained by forcing the head of the first argument to be equal to the "2-elements-head" of the second argument.

Unluckily, this is not enough to work with strings: in fact, predicate p serves as converter between strings and lists.

p(X,W) :- string_codes(X,Y), d(Y,Z), string_codes(W,Z).

Due to library names, this second predicate extends the solution by at least 22 unnecessary characters... So, if anyone could suggest me a way to get rid of those, or any general solution improvement, I'd be very grateful ^^

Note that you can still use d in a sort of "raw-mode", reducing the solution length to 35 bytes. However, the input is technically not a string.

?- d(['H','e','l','l','o',' ','w','o','r','l','d','!'],X)

Try it online!

Thoozee

Posted 2019-07-31T09:57:51.833

Reputation: 21

2

W j, 5 2 bytes

+M

If you want to specify your input, you need to split your input into a list of individual characters before you do your job. (If that disobeys the rules, I will implement a flag that does this job for the writer. (Flags don't count in bytecount.))

Say your input is abcdef. Find imps.py and change those variables:

read = [["a","b","c","d","e","f"]]

prog = '+M'

Explanation

Lots of implicit stuff here. Expanded program:

aaa+M

The + requires 2 inputs and M only provides a single input. Therefore two 'a''s are prepended.

The M only has 1 input required left, so a single 'a' is prepended.
a     % The Implicit input
    M % Map every item of this input with...
 aa   % This every item with this every item...
   +  % Concatenated together

% Implicit Output
j % Join the output without a separator

Wren, 24 bytes

Fn.new{|s|s.map{|n|n+n}}

Try it online!

For every item in the list, return every item concatenated with itself.

user85052

Posted 2019-07-31T09:57:51.833

Reputation:

2

R, 61 bytes

function(x){paste0(rep(strsplit(x,"")[[1]],e=2),collapse="")}

Try it online!

AndriusZ

Posted 2019-07-31T09:57:51.833

Reputation: 219

2

MIT-Scheme 10.*, 52 bytes

(lambda(x)(string-map(lambda(y)(make-string 2 y))x))

MIT-Scheme 10.* apparently has the new string-map which simplifies my earlier approach listed below. The only difference is that make-string is used to convert the character argument into a string and duplicate it.

74 bytes

This is the older solution for MIT-Scheme 9.* before string-map was introduced.

(lambda(x)(list->string(append-map(lambda(k)(list k k))(string->list x))))

This is an anonymous lambda that takes the input as a string, converts it to a list so that it can be mapped (I don't know of another way to do the same), replicating each character and joining it together in one list, after which it is converted back into a string.

user41805

Posted 2019-07-31T09:57:51.833

Reputation: 16 320

2

Acc!!, 42 bytes

N
Count i while _/32 {
Write _
Write _
N
}

Try it online!

Reads one character at a time into the accumulator and outputs the accumulator twice for each character. Loops until it encounters something with an ASCII code less than 32 (newline or EOF).

DLosc

Posted 2019-07-31T09:57:51.833

Reputation: 21 213

2

Forth, (GForth) 55 bytes

: d pad 80 accept 0 do pad i + c@ dup emit emit loop ;

Usage: d [enter]

This text will be doubled. [enter]

Online Forth interpreter

'accept' takes a line of up to 80 chars into pad, then the do loop fetches chars from the pad, duplicates them and emits them to the terminal.

abricker

Posted 2019-07-31T09:57:51.833

Reputation: 61

2

Rexx (Regina), 41 bytes

I just realized the rules specifically state "It will modify this string, duplicating every character." Since the newline is part of the string, I will now leave it in the string and duplicate it, thus reducing my code size to 42 bytes (according to ls -l, TIO says 41).

b=''
DO 80
a=CHARIN()
b=b||a||a
END
SAY b

Try it online!

Old 60 byte version which strips newlines (or CRs depending on your OS.)

b=''
DO 80
a=CHARIN()
b=b||a||a
END
SAY LEFT(b,LENGTH(b)-2)

Alternate last line (same number of bytes):

SAY STRIP(b,,X2C('0a'))

Do 80 iterations, read a char into var a, concatenate two a's onto the end of b during each loop, output the string minus the two newlines or CRs (need to modify for AmigaOS/AROS because it uses CR-LF for line terminators.)

62 byte original version:

DO 80
a=CHARIN()
x=CHAROUT(,a)CHAROUT(,a)
END

Read up to 80 chars from stdin into string var a, write 'a' to stdout twice for each char read in.

abricker

Posted 2019-07-31T09:57:51.833

Reputation: 61

You can use Try it online! which has Rexx available. – Lyxal – 2020-01-18T06:25:41.460

Thanks for the link. – abricker – 2020-01-18T06:59:34.850

1

Ruby, 16 bytes

gsub /./m,'\0\0'

Requires -p.

Try it online!

Alternatively:

gsub(/./m){$&*2}

Try it online!

primo

Posted 2019-07-31T09:57:51.833

Reputation: 30 891

1

Python 2, 31 bytes

Realised I was beaten to it already.

lambda s:''.join(c*2for c in s)

Henry T

Posted 2019-07-31T09:57:51.833

Reputation: 381

1

SNOBOL4 (CSNOBOL4), 69 bytes

	I =INPUT
S	I LEN(1) . X REM . I	:F(O)
	O =O X X	:(S)
O	OUTPUT =O
END

Try it online!

Prints with a single trailing newline.

Giuseppe

Posted 2019-07-31T09:57:51.833

Reputation: 21 077

1

kavod, 16 bytes

*>1+8?99.1-#<#0.

Try it online!

I picked up a random tarpit and decided this would be a nice challenge to solve

Explanation:

*     Take a byte of input and push to stack
>     Push to the register stack without popping from normal stack
1+    Add one to the input
8?    Go to the eighth character in the program if the top of the stack is nonzero (not EOF)
99.   Go to the 99th character in the program (terminating the program). This will be skipped over if input is not EOF
1-    Decrement TOS
#     Print with popping
<#    Get input back from register stack and print it
0.    Go back to the start of the program.

MilkyWay90

Posted 2019-07-31T09:57:51.833

Reputation: 2 264

1

Charcoal, 5 bytes

⭆S⁺ιι

Try it online! Link is to verbose version of code. Explanation:

 S      Input string
⭆       Map over characters and join
   ι    Current character
  ⁺     Plus
    ι   Current character
        Implicitly print

Neil

Posted 2019-07-31T09:57:51.833

Reputation: 95 035

1

PHP, 74 bytes

function doubleSpeaker ($s) {
    return preg_replace('/(.)/', '$1$1', $s);
}

Try it online!

berosoboy

Posted 2019-07-31T09:57:51.833

Reputation: 11

14Welcome to CGCC! The winning criteria for this challenge is [tag:code-golf] which means submissions should attempt to have the smallest amount of bytes. This submission seems to have a lot of excess whitespace and unnecessarily long variable names. Additionally, you should add the language name and score to the header of your submission. – Jo King – 2019-07-31T23:48:56.280

3

Just in a few seconds, your solution was lowered to 41 bytes: Try it online! Nice RegEx idea by the way.

– Night2 – 2019-08-01T09:23:14.413

3

Capturing is pointless. Try it online!

– manatwork – 2019-08-01T09:30:07.280

1Same idea as in my Lua answer btw, just implemented in PHP. – val says Reinstate Monica – 2019-08-01T09:39:13.507

5

Using @manatwork's update and $argn: Try it online! 36 bytes.

– Night2 – 2019-08-01T09:48:04.823

1

Kotlin, 47 bytes

{(0..it.length-1).fold(""){s,c->s+it[c]+it[c]}}

Try it online!

Quinn

Posted 2019-07-31T09:57:51.833

Reputation: 1 153

1

3var, 10 bytes

k'>|[PP'>]

Try it online!

user85052

Posted 2019-07-31T09:57:51.833

Reputation:

1

C (clang), 60 50 bytes

gets(s);while(s[(int)i])putchar(s[(int)(i+=0.5)]);

Try it online!

Saved 10 bytes Thanks to Peter Cordes

Loki

Posted 2019-07-31T09:57:51.833

Reputation: 31

This snippet depends on declarations and initializers (like float i = -0.5) outside the block you're counting. You need to count all the bytes of your code for a whole function or block that can be used on its own without dependencies on other parts of the source code. e.g. a whole function + any global variables it uses. – Peter Cordes – 2019-08-03T02:49:21.823

Interesting idea, though, to use float increments to half-step. putchar would be shorter than printf("%c", and also !=0 is implicit in while(s[(int]i]). I think ISO C guarantees that \0 has integer value 0, and I'm sure that it's guaranteed to be the only "false" character value so a strlen like while(*s++) is a safe. – Peter Cordes – 2019-08-03T02:51:19.957

Congratulations on your first answer! I remember when I first started, it was a bit complicated to figure out what should be counted and what shouldn't be counted (I'm still not sure sometimes). From this meta post, a function is also a valid submission, in which case we can abuse a bunch of things in C to get this 51-byte answer. It's not pretty though

– maxb – 2019-08-06T09:16:27.620

Thanks guys for the comments, still learning so please forgive any mistakes and thanks for the ideas Peter would definitely try implementing them. – Loki – 2019-08-07T11:25:41.007

1

Building on @maxb 41 bytes

– ceilingcat – 2019-08-19T05:32:02.347

1

JavaScript (V8), 28 bytes

s=>[...s].map(n=>n+n).join``

Try it online!

John

Posted 2019-07-31T09:57:51.833

Reputation: 181

1

4, 21 bytes

3.6000180070050050094

Try it online!

Explanation

3.          Start the program
6 00 01     Set memory cell 00 to 1 (BF +)
8 00        Start a loop while memory cell 00 is non-zero
7 00        Feed input to memory cell 00 (BF ,)
5 00 5 00   Print input 2 times ("a" -> "aa")
9           Jump to the corresponding 8       

MilkyWay90

Posted 2019-07-31T09:57:51.833

Reputation: 2 264

1

Agda, 110 Bytes

Sorry, no online interpreter available because this is more of a proof checker.

So this was quite annoying since I tried not to use the standard library and thus had to explicitly define lists. Chars also don't exist by now, but the function is polymorphic, so it would work in this case.

data L(A : Set): Set where
 N : L A
 C : A → L A → L A
d :{A : _}→ L A → L A
d N = N
d(C x y) = C x(C x(d y))

Mega Man

Posted 2019-07-31T09:57:51.833

Reputation: 1 379

1

SimpleTemplate, 23 bytes

This answer is for a language I wrote, which was supposed to be for templates but hasn't seen many updates.

This is the basic "split, loop, output twice", but without the splitting.

{@eachargv.0}{@echo_,_}

And now, ungolfed:

{@each argv.0 as char}
    {@echo char, char}
{@/}

And an explanation:

  • {@each argv.0 as char}
    Loops over each value in argv.0, which is the first argument given when calling the render() method.
    Due to this, you can pass an array of characters or a simple string, and it will loop through it.
    The as char is optional and the default variable name is _.
    Whitespace is optional

  • {@echo char, char}
    Outputs char. Twice.
    Whitespace is optional

  • {@/}
    Closes the scope of the {@each ... }.
    This is optional, as the language was written to keep track of how many scopes were open and automatically closes all at the end.

Pretty simple, right?

You can try it on: http://sandbox.onlinephpfunctions.com/code/d008a116a051df131edf02533182c5305cf8e834
When trying, you can go to line 906 and change the variable between $golfed and $ungolfed to try both versions.

Ismael Miguel

Posted 2019-07-31T09:57:51.833

Reputation: 6 797

1

Forget, 61 55 bytes

I created this language when I was bored one day. I released it the same day as this challenge was posted. I can guarantee this was not designed specifically for this challenge.

in;cleanse;out;out;pop;hasin;in;cleanse;out;out;pop;end

-6 bytes by terminating on EOF
There's no TIO (yet). The interpreter is available here There's a TIO now
Explanation:

in - reads a character from standard input and pushes a pointer to the stack

cleanse - unpoisons the pointer on top of the stack

out - prints the value stored at the address on top of the stack as a character

out - see above

pop - removes the value from the stack to avoid memory leaks

hasin - while characters are available on standard input...

(the body of the loop is the same as before it)

end marks the end of the loop

The only way this program can error is if the interpreter forgets the value stored at the address on the stack and the program attempts to use it.

Benjamin Urquhart

Posted 2019-07-31T09:57:51.833

Reputation: 1 262

1

Aceto: 5 bytes

,dppO

Doesn't work on TIO, because it hangs indefinitely. Buffering might prevent you from seeing the result, run with -F to immediately flush all output.

L3viathan

Posted 2019-07-31T09:57:51.833

Reputation: 3 151

1

Brain-Flak, 26 bytes

{(({}<>))<>}<>{({}<>)<>}<>

Pretty simple, and my first Brain-Flak answer :D

(Note: this requires the -a and -ac flags for ascii I/O)

How it works

{  Begins a loop that will run for every character of input
(({}<>))   Pops the top element of the stack and pushes two copies of it to the second stack
<>  Go back to the first stack
}   End loop
<>   Go to the second stack
{({}<>)<>}   Reverse the second stack and puts it onto the first
<>  Go to the first stack do it outputs it

Try it Online!

EdgyNerd

Posted 2019-07-31T09:57:51.833

Reputation: 1 106

1

Q'Nial7, 28 bytes

d is OP N{link cols mix N N}

result:

     d 'Double Speak!'
DDoouubbllee  SSppeeaakk!!

Explanation, using detailed picture mode:

     set "decor                 %turn on decoration of atoms and empty arrays,
                                %gives a picture that distinguishes all atoms                                  
"decor                                                                          
     set "diagram                                                               
"diagram                        %set default display mode to diagram,
                                %give full boxed picture of results                                 
     N:='Double Speak!'         %define string N                                       
+--+--+--+--+--+--+--+--+--+--+--+--+--+                                        
|`D|`o|`u|`b|`l|`e|` |`S|`p|`e|`a|`k|`!|                                        
+--+--+--+--+--+--+--+--+--+--+--+--+--+                                        
     mix N N                    %nesting restructuring: create table of items
                                %from list of items, the list being N N                                       
+--+--+--+--+--+--+--+--+--+--+--+--+--+                                        
|`D|`o|`u|`b|`l|`e|` |`S|`p|`e|`a|`k|`!|                                        
+--+--+--+--+--+--+--+--+--+--+--+--+--+                                        
|`D|`o|`u|`b|`l|`e|` |`S|`p|`e|`a|`k|`!|                                        
+--+--+--+--+--+--+--+--+--+--+--+--+--+                                        
     cols mix N N               %nesting restructuring: list of columns
                                %of the table                                       
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------
|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+
||`D|`D|||`o|`o|||`u|`u|||`b|`b|||`l|`l|||`e|`e|||` |` |||`S|`S|||`p|`p|||`e|`e|
|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+|+--+--+
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------

+-------+-------+-------+                                                       
|+--+--+|+--+--+|+--+--+|                                                       
||`a|`a|||`k|`k|||`!|`!||                                                       
|+--+--+|+--+--+|+--+--+|                                                       
+-------+-------+-------+                                                       
     link cols mix N N          %construction op: items of the first item of N
                                %are followed by the items of the second item of N, etc.                                       
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 
|`D|`D|`o|`o|`u|`u|`b|`b|`l|`l|`e|`e|` |` |`S|`S|`p|`p|`e|`e|`a|`a|`k|`k|`!|`!| 
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 

M L

Posted 2019-07-31T09:57:51.833

Reputation: 2 865

1

Go, 110 bytes

func main(){for j:=0;j<len(os.Args[1]);j++{fmt.Printf("%c%c",os.Args[1][j],os.Args[1][j])};fmt.Printf("\n");}

Try It on Jdoodle!

T. Salim

Posted 2019-07-31T09:57:51.833

Reputation: 575

1

C#, 104 bytes

public class P{public static void Main(string[]a){foreach(char c in a[0])System.Console.Write(c+""+c);}}

Try Online

canttalkjustcode

Posted 2019-07-31T09:57:51.833

Reputation: 131

1

AsciiDots, 27 21 bytes

.>#a?**>$_a#
 \---/\/

Note that this halts in an error, which is allowed.

-6 bytes by getting rid of whitespace and not using warps.

Try it online!

EdgyNerd

Posted 2019-07-31T09:57:51.833

Reputation: 1 106

1

Piet, 20 codels

If you are using npiet, you might want to use the -q option to stop the interpreter from printing a prompt for each character.

Double Speak

Rundown

If STDIN contains no character, Piet's input functions will not lock or throw an error, but simply fail quietly. To know if we reached the end of the string, we therefore push a sentinel 0 to the stack to detect if nothing was read.

In pseudo code:

1. Push 1 to stack
2. Perform NOT on top of stack
3. Attempt to read character
4. Duplicate top of stack, twice.
5. Perform NOT on top of stack, twice,
   leaving a 1 if character was read, 0 otherwise.
6. Turn Direction Pointer as many steps as value on top of stack.
7. If we turn, print character, twice, and go to start
8. If we do not turn, get caught in exit block. (Bottom left corner.)

gastropner

Posted 2019-07-31T09:57:51.833

Reputation: 3 264

1

Kipple (cipple), 28 bytes

(i>ac<0>b(a-1b+1c+1a?)b>o<c)

It's actually suprisingly difficult to duplicate stack items in Kipple

Expanation

(i>ac<0>b(a-1b+1c+1a?)b>o<c) Full program

(i                         ) Loops until the input stack is empty
 i>a                         Push the top item of the input stack to stack A
    c<a>b                    Push 0's to stack B and C
         (a-1b+1c+1a?)       A loop that basically pushes the top of stack A to stack B and C
                      b>o<c  Push the top of stack B and stack C to the output stack

Try it online!

EdgyNerd

Posted 2019-07-31T09:57:51.833

Reputation: 1 106

1

MathGolf, 2 bytes

I hope this isn't a duplicate. (Great, it isn't.)

_^

Explanation

_  Duplicate the implicit input
 ^ Zip

Try it online!

user85052

Posted 2019-07-31T09:57:51.833

Reputation:

1

Hexadecimal Stacking Pseudo-Assembly Language, 60 bytes

000000100000420000400000420000400000030000040000140000010000

Try it online!

000000 Label start:
100000 read character
420000 load it into register
400000 push it on the stack another time
420000 load it into register
400000 push it on the stack another time
030000 ignore next command if top of stack is non-zero
040000 end program
140000 print string
010000 go to start

Dorian

Posted 2019-07-31T09:57:51.833

Reputation: 1 521

1

Python 3, 31 bytes

for t in input():print(t,end=t)

a simple program of python

for t in input():

asking for the input, and doing a for loop for every char in the string.

print(t,end=t)

print the character, and then close the line with the same character.

yarr33

Posted 2019-07-31T09:57:51.833

Reputation: 21

Same as A _'s revised old solution posted 83 days earlier.

– manatwork – 2019-10-23T08:31:55.133

1

Clojure, 25 bytes

(fn[s](apply str(map #(str % %)s)))

Joshua

Posted 2019-07-31T09:57:51.833

Reputation: 231

1

[awk], 24 bytes

awk '$0=gensub(/./,"&&","g")' <<< "Double speak"

Try it online!

stephanmg

Posted 2019-07-31T09:57:51.833

Reputation: 261

1I guess you accidentally pasted an older code version since you still debugged it. That would explain that \n. – manatwork – 2019-11-11T11:00:01.053

Yes, you are right. Thanks for pointing me to this. – stephanmg – 2019-11-11T11:01:30.890

1

You could shorten it by learning from Leo Tenenbaum's sed solution and avoid using a capture group: $0=gensub(/./,"&&","g").

– manatwork – 2019-11-11T11:03:36.583

Thanks @manatwork. I shortened it. – stephanmg – 2019-11-11T11:08:30.210

1

[sed], 13 bytes

sed 's/\(.\)/&&/g'  <<< "Double speak"

Try it online!

stephanmg

Posted 2019-07-31T09:57:51.833

Reputation: 261

2

>

  • Please use a properly formatted heading line for your answer so the leaderboard script can parse it. 2) The quotes around the code are necessary only when specified in command line due to the shell's own parsing rules, they not need to appear in the answer and even less to get counted. 3) As possible please add TIO links to your answers so people can try them out easier and see how input is supposed to get passed to the code.
  • – manatwork – 2019-11-11T10:54:15.463

    2

    Just as information (its existence doesn't invalidate your solution), Leo Tenenbaum's sed solution is shorter. ☹

    – manatwork – 2019-11-11T10:56:40.863

    @manatwork: Oh sorry, I visually "grepped" through the StackExchange posts, but didn't see sed. – stephanmg – 2019-11-11T11:03:31.910

    Yes, capture group is not needed, so @LeoTenenBaums's solution is better. – stephanmg – 2019-11-11T11:14:33.947

    1

    Bash, 45 bytes

    while IFS= read -n1 c;do printf %s"$c$c";done 
    

    Try it online!

    stephanmg

    Posted 2019-07-31T09:57:51.833

    Reputation: 261

    Yeah I removed this part. Btw. I'm not sure if it's a valid solution, because the string is not modified but a copy is printed. – stephanmg – 2019-11-11T11:45:37.147

    @JoKing: You are probably right. – stephanmg – 2019-11-11T11:57:38.433

    1

    Binary Lambda Calculus, 10 bytes

    8446 0016 c25b 3fdf 9ade
    

    This program was on this page and was known as a ``stuttering'' program.

    user85052

    Posted 2019-07-31T09:57:51.833

    Reputation:

    1

    GolfScript, 9 bytes

    Great if this hasn't been posted yet.

    [{.}/]''+
    

    Try it online!

    user85052

    Posted 2019-07-31T09:57:51.833

    Reputation:

    1

    @, 8 bytes

    ¤ōōč
    

    Explanation

    ¤    Forever
       č Read a character
     ōō  Output twice
    

    user85052

    Posted 2019-07-31T09:57:51.833

    Reputation:

    1

    GolfScript, 4 bytes

    {.}%
    

    Try it online!

    Takes an input, which it treats as a list of characters, and maps . (push top item of stack to stack) over them.

    Pseudo Nym

    Posted 2019-07-31T09:57:51.833

    Reputation: 181

    1

    Pip, 4 bytes

    aWVa
    

    Try it online!

    The operator WV ("weave") takes two iterables and interleaves their elements. In this case, weaving the input string with itself produces the desired output.

    DLosc

    Posted 2019-07-31T09:57:51.833

    Reputation: 21 213

    1

    Burlesque, 2 bytes

    )J
    

    Try it online!

    ) # Map (implicitly explode and apply to each character then concatenate)
    J # Duplicate
    

    DeathIncarnate

    Posted 2019-07-31T09:57:51.833

    Reputation: 916

    0

    Pyth, 5 bytes

    sm*2d
    s      Concatenate
      *2d  lambda d: d*2
     m     Mapped over
         Q Input (implicit
    

    Try it online!

    Tornado547

    Posted 2019-07-31T09:57:51.833

    Reputation: 389

    3 byter here, but theres a 2 byte solution for pyth here – frank – 2019-12-02T22:38:06.887

    0

    QBasic, 58 bytes

    LINE INPUT s$
    FOR i=1TO LEN(s$)*2
    ?MID$(s$,i/2+.1,1);
    NEXT
    

    Explanation

    LINE INPUT reads all input characters until a newline into s$. We loop i from 1 up to twice the length of the string and output the i/2th character (rounded up) at each iteration. There's a slight hitch, in that QBasic rounds numbers with a fractional part of .5 up sometimes and down other times; adding a small amount like .1 is sufficient to round the halves up, while the whole numbers still get rounded back down.

    DLosc

    Posted 2019-07-31T09:57:51.833

    Reputation: 21 213