| Bytes | Lang | Time | Link |
|---|---|---|---|
| 003 | Pip | 191221T090409Z | DLosc |
| 035 | Swift 6 | 240315T151700Z | macOSist |
| 091 | Bespoke | 250118T042051Z | Josiah W |
| 156 | C | 250129T200337Z | Laszlo P |
| 012 | Kakoune | 250121T051504Z | JoshM |
| 050 | Tcl | 250119T231859Z | sergiol |
| 053 | Tcl | 250118T215143Z | sergiol |
| 028 | Zsh | 250118T010245Z | roblogic |
| 043 | Javascript nodejs | 250117T190652Z | Laszlo P |
| 164 | Malbolge Unshackled | 250117T163223Z | Weird Gl |
| 040 | R | 240725T155223Z | David Jo |
| 080 | Custom Turing Machine | 240725T134441Z | z.. |
| 043 | Excel | 240724T112807Z | z.. |
| 002 | vemf | 240620T141404Z | taswelll |
| 004 | Uiua | 240620T124454Z | Joonas |
| 015 | Befalse | 240620T074846Z | Bubbler |
| 011 | Uiua | 240618T155712Z | Europe20 |
| 015 | awk — 15 ASCII bytes | 240527T094739Z | RARE Kpo |
| 088 | Lazy K | 240526T164239Z | Esolangi |
| 042 | Nibbles | 240525T231756Z | DLosc |
| 025 | YASEPL | 240412T135101Z | madeforl |
| 004 | Uiua | 240315T153948Z | noodle p |
| 010 | Z80 | 220714T221436Z | NoLonger |
| 059 | Uiua | 230929T032633Z | jado |
| 025 | X86_64/Linux Machine Code | 230929T024721Z | Noah |
| 001 | Thunno 2 | 230528T142303Z | The Thon |
| 057 | Rockstar | 200924T140911Z | Shaggy |
| 004 | ><> | 230326T184019Z | The Thon |
| nan | 230326T145722Z | The Thon | |
| 122 | Scratch | 230326T142733Z | The Thon |
| 038 | Python 3 | 230116T134939Z | Joao-3 |
| 027 | JavaScript Node.js | 230316T111041Z | Fhuvi |
| 057 | D | 230117T031714Z | The Zip |
| 030 | Arturo | 230117T023532Z | chunes |
| 012 | Rattle | 220908T140447Z | d01 |
| 025 | Wolfram Language Mathematica | 220405T094346Z | JSorngar |
| 045 | Rust | 190731T112630Z | wizzwizz |
| 016 | Raku | 221123T004516Z | Mark Ree |
| 002 | str | 221123T033228Z | The Fift |
| nan | Piet + asciipiet | 221122T233715Z | anderium |
| 022 | Knight v2.0alpha | 220918T061027Z | Sampersa |
| nan | C gcc | 220916T191726Z | Breadlea |
| 039 | JavaScript | 220911T082644Z | Missing |
| 031 | Python | 220911T072147Z | Henry W |
| 086 | Leaf Lang | 220909T171647Z | Breadlea |
| 096 | makina | 220908T165450Z | Ginger |
| 007 | yup | 220907T121340Z | Kevin Cr |
| nan | CellTail | 220907T095652Z | mousetai |
| 047 | Prolog SWI | 220907T132047Z | Razetime |
| 021 | Raku | 220907T053602Z | south |
| nan | Fig | 220907T024419Z | Seggan |
| 036 | MUMPS | 220719T214851Z | Ryan Pat |
| 031 | Python | 220718T011826Z | Eric Xue |
| 011 | K ngn/k | 220527T045227Z | oeuf |
| 009 | Alice | 220714T224029Z | Julian |
| 006 | BRASCA | 210126T082427Z | SjoerdPe |
| 032 | Python 3 | 220527T170413Z | axolotl |
| 040 | GeoGebra | 220527T071749Z | Aiden Ch |
| 038 | Rust | 220526T044733Z | TehPers |
| 024 | Python 3 | 220331T074400Z | Glen Hen |
| 142 | A0A0 | 210614T141603Z | stefvans |
| 114 | Rust | 220408T110955Z | JSorngar |
| 016 | Curry PAKCS | 220405T115955Z | Razetime |
| 043 | C clang | 220331T025755Z | user1117 |
| 055 | JavascriptNode.js | 220331T023313Z | Shiv |
| 039 | TIBasic | 210912T200627Z | Youserna |
| 014 | dotcomma | 210613T165428Z | Jay Ryan |
| 048 | dotcomma | 201002T140256Z | Dorian |
| 012 | Mascarpone | 220121T163800Z | user1011 |
| 028 | Lexurgy | 220121T061816Z | bigyihsu |
| 005 | Binary Pi Calculus | 211029T235504Z | Soup Gir |
| 007 | Q | 211027T022311Z | Gustavo |
| 3124 | Python 3 | 211004T185108Z | Alan Bag |
| 085 | CLCINTERCAL | 210917T095644Z | user1004 |
| 7344 | Minim | 210916T213245Z | Christia |
| 002 | Vyxal | 210914T203947Z | das code |
| 004 | GolfScript | 190804T145515Z | Kenzie |
| 067 | Python | 210914T182236Z | Alan Bag |
| 018 | Julia 1.0 | 210416T115715Z | MarcMush |
| 001 | Vyxal | 210126T074928Z | lyxal |
| 043 | Excel | 210821T134235Z | Axuary |
| 003 | Dis | 210821T083208Z | user1004 |
| 089 | Zephyr | 210821T035011Z | DLosc |
| 004 | MineFriff | 210821T013431Z | lyxal |
| 113 | Arduino | 210820T150902Z | Bbrk24 |
| 031 | Python 3.8 | 210729T133423Z | SysWOW64 |
| 017 | Pxem | 210615T121507Z | user1004 |
| 011 | Hexagony | 210614T053846Z | Undersla |
| 008 | SM83 | 210614T043240Z | NoLonger |
| 029 | <>^v | 210613T232110Z | astroide |
| 335 | Taxi | 191111T195636Z | anderium |
| 315 | [MashedPotatoes] | 210417T220812Z | cnamejj |
| 005 | V vim | 210417T095106Z | kops |
| 007 | Ly | 210416T230034Z | cnamejj |
| 006 | Numberwang | 210416T134341Z | Cinaski |
| 012 | Factor + sequences.repeating | 210416T114607Z | chunes |
| 011 | Unlambda | 210416T091439Z | Emil Jeř |
| 003 | Duocentehexaquinquagesimal | 210415T230345Z | Makonede |
| 018 | Haskell | 210219T215515Z | MLavrent |
| 008 | Labyrinth | 200924T035405Z | Bubbler |
| 035 | Kotlin | 210213T144251Z | grian |
| 043 | Python 3 | 210215T014817Z | import h |
| 038 | Whispers v1 | 210205T153559Z | Michael |
| 032 | naz | 200103T053301Z | sporebal |
| nan | Malbolge | 190731T175207Z | Kamila S |
| 088 | VBScript | 210201T171029Z | wasif |
| 031 | Python 3 | 210129T150342Z | Gotoro |
| 031 | Lua | 210126T054142Z | Benrob03 |
| 064 | Python 3 | 210118T065232Z | nTerior |
| 021 | Scala | 210118T015918Z | Michael |
| 003 | Canvas | 210118T010711Z | hakr14 |
| 035 | Python 3 | 200918T145920Z | Koishore |
| 026 | Marbelous | 200924T080926Z | jonatjan |
| 004 | Pip | 200924T071435Z | Razetime |
| 008 | Add++ | 200924T043711Z | lyxal |
| 005 | Arn | 200815T050748Z | ZippyMag |
| 008 | MAWP | 200814T044828Z | Razetime |
| 079 | Kite | 200703T082032Z | user9206 |
| 028 | JavaScript V8 | 200627T204457Z | nph |
| nan | x8616 machine code | 190731T144206Z | 640KB |
| 012 | FEU | 200628T085953Z | PkmnQ |
| 085 | Brainetry | 200627T220607Z | RGS |
| 037 | PHP | 200515T192814Z | bribgris |
| 026 | Elixir | 200515T162233Z | bribgris |
| 011 | Pip | 190731T181147Z | Kenzie |
| 065 | Fortran GFortran | 200115T150836Z | DeathInc |
| 041 | Rexx Regina | 200118T055251Z | abricker |
| 055 | Forth | 200117T030839Z | abricker |
| 002 | Burlesque | 200115T145026Z | DeathInc |
| 052 | W j | 191103T140151Z | user8505 |
| 042 | Acc!! | 191221T090931Z | DLosc |
| 058 | QBasic | 191221T085827Z | DLosc |
| nan | Keg | 190731T101511Z | user8505 |
| 004 | GolfScript | 191203T010831Z | Pseudo N |
| 005 | Pyth | 191202T213917Z | Tornado5 |
| 052 | MITScheme 10.* | 191127T171047Z | user4180 |
| 008 | @ | 191123T141557Z | user8505 |
| 009 | GolfScript | 191123T140056Z | user8505 |
| 010 | Binary Lambda Calculus | 191116T115758Z | user8505 |
| 049 | Poetic | 191018T043420Z | JosiahRy |
| 045 | Bash | 191111T105209Z | stephanm |
| 024 | [awk] | 191111T104141Z | stephanm |
| 013 | [sed] | 191111T104335Z | stephanm |
| 011 | Wolfram Language Mathematica | 190731T120508Z | att |
| 061 | R | 191105T070552Z | AndriusZ |
| 025 | Clojure | 191024T141953Z | Joshua |
| 3425 | Python | 190731T100612Z | user8505 |
| 031 | Python 3 | 191023T040753Z | yarr33 |
| 060 | Hexadecimal Stacking PseudoAssembly Language | 191022T145102Z | Dorian |
| 087 | SWIProlog | 191022T132715Z | Thoozee |
| 013 | Haskell | 190731T101715Z | Maki |
| 005 | Backhand | 191018T054136Z | Jo King |
| 039 | Forth gforth | 191018T050501Z | Bubbler |
| 002 | MathGolf | 191013T062054Z | user8505 |
| 3848 | Seed | 190801T094826Z | Kamila S |
| 011 | Perl 6 | 190731T120616Z | Jo King |
| 028 | Kipple cipple | 190910T201051Z | Edgex42 |
| 021 | AsciiDots | 190820T154759Z | Edgex42 |
| 020 | Piet | 190821T035649Z | gastropn |
| 005 | K ngn/k | 190820T090838Z | scrawl |
| 056 | C gcc | 190801T015300Z | ErikF |
| 104 | C# | 190820T013641Z | canttalk |
| 110 | Go | 190818T010133Z | T. Salim |
| 019 | Pepe | 190818T015656Z | u-ndefin |
| 003 | J | 190731T114510Z | Galen Iv |
| 003 | Gaia | 190813T083531Z | Edgex42 |
| 005 | Aceto | 190807T065033Z | L3viatha |
| 100 | Fortran GFortran | 190802T122744Z | roblogic |
| 055 | Forget | 190806T202448Z | Benjamin |
| 031 | Lua | 190731T220649Z | val - di |
| 025 | Octave | 190803T193434Z | PieCot |
| 009 | Cubix | 190807T204052Z | MickyT |
| 016 | Matlab >= r2015a | 190803T193244Z | PieCot |
| 028 | Q'Nial7 | 190807T182853Z | M L |
| 050 | C clang | 190801T111055Z | Loki |
| 026 | BrainFlak | 190807T073416Z | Edgex42 |
| 059 | PHP | 190802T102611Z | ShiSHcat |
| 023 | SimpleTemplate | 190805T091409Z | Ismael M |
| 001 | MathGolf | 190806T074133Z | maxb |
| 032 | PHP | 190801T092540Z | Night2 |
| 044 | Kotlin | 190806T041222Z | Brojowsk |
| 110 | Agda | 190804T191831Z | univalen |
| 066 | Twig | 190802T184600Z | Ismael M |
| 005 | K oK | 190802T145709Z | mkst |
| 048 | Ook! | 190802T125033Z | Charlie |
| 006 | Retina 0.8.2 | 190731T100353Z | Neil |
| 024 | C# Visual C# Interactive Compiler with Regex†flag | 190731T152812Z | Kevin Cr |
| 027 | Java 8 | 190731T114439Z | Kevin Cr |
| 021 | 4 | 190801T162025Z | MilkyWay |
| 072 | Bash | 190801T153946Z | Aaron R. |
| 022 | JavaScript Node.js | 190731T100500Z | Arnauld |
| 028 | JavaScript V8 | 190801T151743Z | John |
| 006 | brainfuck | 190731T110232Z | Charlie |
| 001 | Jelly | 190731T204104Z | Eric Bur |
| 033 | Perl 6 | 190731T115558Z | Scimon P |
| 006 | x86 machine code | 190801T123133Z | nwellnho |
| 087 | Java OpenJDK 8 | 190801T111351Z | CuttingC |
| 030 | Swift 5 | 190801T083450Z | Tiziano |
| 001 | Jelly | 190731T101300Z | Mr. Xcod |
| 008 | 33 | 190801T073739Z | TheOnlyM |
| 002 | 05AB1E | 190731T100607Z | Kevin Cr |
| 014 | Starry | 190801T062300Z | Luis Men |
| 010 | 3var | 190801T031845Z | user8505 |
| 026 | C# Visual C# Interactive Compiler | 190801T021422Z | dana |
| 041 | C gcc | 190801T014030Z | AI221 |
| 039 | Bash | 190731T145908Z | roblogic |
| 047 | Kotlin | 190801T011122Z | Quinn |
| 213 | Pyramid Scheme | 190731T120209Z | Jo King |
| 074 | PHP | 190731T231958Z | Andr |
| 029 | Zsh | 190731T204102Z | GammaFun |
| 005 | Charcoal | 190731T200441Z | Neil |
| 016 | kavod | 190731T194759Z | MilkyWay |
| 009 | 8086/8088 machine code | 190731T190456Z | Sophie S |
| 007 | Minkolang v.0.15 | 190731T190325Z | Conor O& |
| 012 | !@#$%^&*_+ | 190731T185540Z | Conor O& |
| 002 | J | 190731T184251Z | DevonMcC |
| 009 | ><> | 190731T184804Z | Conor O& |
| 011 | Flobnar | 190731T180223Z | Esolangi |
| 003 | Husk | 190731T175547Z | Esolangi |
| 003 | CJam | 190731T175105Z | Esolangi |
| 475 | Turing Machine But Way Worse | 190731T164503Z | MilkyWay |
| 011 | Labyrinth | 190731T172948Z | Jonathan |
| 004 | Retina | 190731T170849Z | Martin E |
| 021 | PowerShell | 190731T121105Z | Veskah |
| 008 | Haskell | 190731T160935Z | xnor |
| 040 | Forth gforth | 190731T155553Z | Maya |
| 008 | Befunge93 | 190731T155541Z | negative |
| 033 | R | 190731T153720Z | Robert S |
| 001 | Jelly | 190731T154851Z | Jonathan |
| 017 | Triangularity | 190731T152420Z | Mr. Xcod |
| 164 | Shakespeare Programming Language | 190731T133532Z | Charlie |
| 028 | VDMSL | 190731T103649Z | Expired |
| 106 | Shakespeare Programming Language | 190731T140313Z | Maya |
| 002 | Stax | 190731T143219Z | Khuldrae |
| 010 | Z80Golf | 190731T135119Z | Maya |
| 043 | Red | 190731T134648Z | Galen Iv |
| 048 | BrainFlak | 190731T130730Z | Wheat Wi |
| 040 | C gcc | 190731T130722Z | pommicke |
| 012 | jq Rrj | 190731T130518Z | manatwor |
| 008 | sed | 190731T115221Z | pommicke |
| 032 | Factor | 190731T125120Z | Galen Iv |
| 012 | Labyrinth | 190731T123841Z | Charlie |
| 069 | SNOBOL4 CSNOBOL4 | 190731T122424Z | Giuseppe |
| 002 | Japt | 190731T122248Z | Shaggy |
| 001 | Gaia | 190731T122245Z | Giuseppe |
| 037 | Scala | 190731T121559Z | Dr Y Wit |
| 001 | Japt m | 190731T121435Z | Oliver |
| 043 | Oracle SQL | 190731T121313Z | Dr Y Wit |
| 016 | Ruby | 190731T113119Z | primo |
| 035 | Standard ML MLton | 190731T114214Z | Laikoni |
| 078 | TSQL 2008 | 190731T113639Z | t-clause |
| 015 | Haskell | 190731T113334Z | flawr |
| 017 | MarioLANG | 190731T111005Z | Charlie |
| 031 | Python 2 | 190731T113126Z | Henry T |
| 033 | Whitespace | 190731T112820Z | Kevin Cr |
| 006 | Befunge98 PyFunge | 190731T110506Z | Cinaski |
| 005 | Gema | 190731T103540Z | manatwor |
| 002 | Pyth | 190731T103109Z | Sok |
| 010 | Perl 5 0777p Mre=/s | 190731T101941Z | Nahuel F |
| 004 | QuadR | 190731T100728Z | Adá |
| 002 | Brachylog | 190731T100336Z | Fatalize |
| 002 | APL dzaima/APL | 190731T100213Z | Adá |
Pip, 4 3 bytes
aZa
The operator Z ("zip") takes two iterables and returns a list of pairs of their elements. In this case, we zip the input string with itself. By default, lists are concatenated together before being printed, which produces the desired output.
Swift 6, 40 35 bytes
let f={""+($0+"").flatMap{[$0,$0]}}
Bespoke, 121 91 bytes
-30 bytes by taking ch to the power of itself, which errors out upon EOF.
doubles,doubles,going by
we defy,we defy
speeding out of mouths to spit
double it,double it
I decided to make this one in the form of a rhyming poem.
C, 156 bytes
#include<stdio.h>
#include<string.h>
void main(int argc,char*argv[]){for(int i=0;i<strlen(argv[1]);i++){printf("%c",argv[1][i]);printf("%c",argv[1][i]);};}
Kakoune, 12 bytes
afaik there is no online interpreter for kakoune
%<a-s>_s.<ret>ypx;yp
sorry, colors in the demo are a bit weird because I've modified a script meant for vim.
not sure why, but if one of the cursors is selecting a newline pasting happens differently so I handle newlines separately
% # select whole buffer
<a-s> # split selection at line ends
_ # deselect newlines
s.<ret> # spawn a cursor for each character
yp # copy and paste with each cursor
x; # select newlines on each line
yp # copy and paste with each cursor
if it worked as expected we could just do %s.<ret>yp and save a bunch of bytes
Tcl, 50 bytes
lmap c [split {*}$argv ""] {append r $c$c}
puts $r
This is a command line parameter input instead of a function, as in my other answer.
Javascript (nodejs), 43 bytes
6 Bytes saved due to @Weird Glyphs
process.argv[1].split``.map(a=>a+a).join``
To run, go to https://www.onlinegdb.com/, paste in the program, and input "Double Speak!" for the command line argument section, and hit run!
Malbolge Unshackled, 170 164 bytes
(aBA@?>=<;:9876543210/.-,JH)('&%$#"!~}|{zyKwvutsrqponmlkjihgfedcF!`_^]\[ZYX*tUTSRQPONMLKJIHGF?DCB`@?\=<;:9876543,10/.^,+*)j'&g|#"!~}|{zyxwputsrqponmlkjihafedcF[`_^{
Warning: This code doesn't terminate on EOF, therefore it will throw an "invalid unicode codepoint" error at the end. You can also use it in regular Malbolge, and it will print a garbage value indefinitely.
While browsing the questions with a leaderboard available, I saw that this question was one of the rare ones where a pure Malbolge program got the most upvotes. Nice. The attempt made by Kamila Szewczyk is really impressive, using 20775 bytes. In order to compare this, the cat program made by Matthias Lutter is 9382 bytes long. So this is probably overkill, but it's still reasonable. On the other hand, an alternative program was also provided in the answer, using 2334 bytes if checking EOF is not mandatory. Without that restriction, a cat program is only 62 bytes in Malbolge, so it's clearly possible to improve that score. I'm only going to give a short explanation, since this is using the same strategy used for other looping programs I made, and explaining Malbolge code takes a lot of time, but the short explanation is this:
ji <- Put the data pointer somewhere, and the code pointer
at the end of the program
ooooooo
ooooooooo
ooooooo
<i <- Printing loop (happens every 2 cycles)
ooooooooo
oooooo
/ <- Used for jumping ahead (first j in code section)
oo
ooooooooo
ooooooooo
o
ji <- Data pointer resetting loop
oooooo
ooo
/i <- Input reading loop (happens every 4 cycles)
oooo
ooooooooo
ooo
pooo<ooi <- MAIN LOOP: Alternates between j, /, <, j. Only the j are
properly loaded at the start of the program
ooooooo
oooopoooo/oooo <- Some values for crazyop and in order to go back
joojpoo <- Code section, we need to apply multiple crazyops
ooooooooo in order to load the correct values into the main loop...
poooooooo
oooooopoo
oojpoooi <- ...and we can now start it!
I'm probably not going to make a version of this that ends on EOF, because the standard cat program in Malbolge Unshackled is... 208KB long...
R, 40 bytes
message(rep(strsplit(x,'')[[1]],each=2))
Here, the input x is implicit, don't know if still counts!
Custom Turing Machine, 80 bytes
Expects the input as \$string$\$.
q0 * _ q1 * ** - >
q1 * _ q2 * ** > >
q2 * _ q1 * ** - >
q2 $ _ q3 _ _ - -
Demo
vemf, 2 bytes
‼2
Standalone program that takes a command line argument with text and outputs to stdout. Also a function. Try it online
Befalse, 15 bytes
!/,$~?\
\ ..$/
A straightforward loop using four mirrors. , pushes -1 on EOF, so its bitwise NOT ~ is tested for zero ? to exit the loop.
Uiua, 11 bytes, 5 characters
/⊂≡⊂.
awk — 15 ASCII bytes
awk 'gsub(/./,"&&")_'
fully POSIX-compliant awk code minus the BS of custom codepages
Lazy K, 88 bytes
si`s`k``s`k`s``s`k``s`0001ki``s`0001`001`0001``s`k`si(ss`si`kk)`kk``s`0001k`k``si01``sii
Can be tested here:
https://crypto.stanford.edu/~blynn/lambda/crazyl.html
This uses the Y combinator.
Another 88 byte variant using S S K (λxy. xyx) for the recursion:
ssk``s`0001`001``s`k``s`0001ki``s`0001`001`0001``s`k`si(ss`si`kk)`kk``s`k*s*is`001``si01
(Note that the inner invocation of S S K is done using Iota expression *is.)
Yet another 88 byte variant using S I I (λxy. xxy) for the recursion:
sii``s`k`s``s`k``s`0001ki``s`0001`001`0001``s`k`si(ss`si`kk)`kk``s`0001`001``sii`k``si01
Nibbles, 4 nibbles (2 bytes)
+.@:
Explanation
Two $s are implicit at the end of the program.
+.@:$$
@ # First line of stdin
. # Map to each character:
:$$ # Append to itself
+ # Concatenate that list of strings together
YASEPL, 26 25 bytes
=i=1'=l®1`1!m¥i,1~~!+}2,l
explanation
=i=1'=l®1`1!m¥i,1~~!+}2,l packed
=i increment variable
=1' var1 = input string
=l®1 L = length of input string (var1)
`1 ! }2,l while I < L ...
!m¥i,1 get character from input string at index I
~~ write it twice
+ add 1 to I and check loop.
YASEPL, 17 bytes
(this one exits with an error)
=i=1'!m¥i,1~~!+?6
Uiua, 4 bytes
♭⍉⊟.
Starting with the string "Abc":
couple ⊟ the string with a duplicate . of itself:
[ "Abc"
"Abc" ]
transpose ⍉ this.
[ "AA"
"bb"
"cc" ]
deshape ♭ (flatten) this, yielding the final string:
"AAbbcc"
Z80, 10 bytes
Input in port ii, output in port oo.
DB ii D3 oo B7 C8 D3 oo
18 F6
Disassembly:
f:
in a,(ii)
out (oo),a
or a
ret z
out (oo),a
jr f
Uiua, 5 chars / 9 bytes
♭⍉[.]
Uiua is a fusion of the stack-based and array-oriented paradigms. It is read right-to-left.
[.] duplicates the top of the stack (the input string) and puts both into an array.
⍉ transposes the array so the 2 input strings go top down (every row contains 2 of a char).
♭ deshapes the array, turning it back into a string.
X86_64/Linux Machine Code, 27 25 Bytes
Usage:
$> gcc -Wl,-Tbss=0x80000000 -s -static -nostartfiles -nodefaultlibs -nostdlib -Wl,--build-id=none to-double-speak.S -o to-double-speak
$> echo -n "<input>" | ./to-double-speak
Program reads input from stdin (it is sensitive to the exact byte count of input, i.e stray spaces/new lines will change result).
Output is printed to STDOUT
Notes:
- -4 more bytes without
EXIT_CLEANLYdefined (it will segfault to exit). This makes the minimum size 21 Bytes. - The 25-byte size assumes the above compile command which sets the BSS address at an ideal value. With generic compile commands (no linker inputs), its 27-bytes.
Program:
/* Uncomment below if BSS was setup at 2^20. */
/* #define IDEAL_BSS. */
/* Comment out to save 4 bytes (with segfault to exit). */
#define EXIT_CLEANLY
.global _start
.text
_start:
/* Incoming registers are zero. */
decl %edx
#ifdef IDEAL_BSS
btsl %edx, %esi
#else
movl $G_mem, %esi
#endif
/* eax == 0 == SYS_read. */
/* edi == 0 == STDIN. */
syscall
/* Store length in ebp. */
xchgl %eax, %ebp
negl %edx
loop:
/* Setup SYS_write. */
movb $1, %al
/* SYS_write == 1 == STDOUT. */
movl %eax, %edi
syscall
/* Assuming no IO error, we will have successfully written 1
byte so return (eax) will be 1 again ready for second
syscall. */
syscall
/* Increment esi. */
lodsb
/* Loop through all bytes. */
decl %ebp
jnz loop
#ifdef EXIT_CLEANLY
movb $60, %al
syscall
#endif
.section .bss
G_mem: .space(4096 * 8)
Example/Tests:
$> for x in "This is double speak" "Hello World" "AaBbCcDdEeFf"; do echo -n "${x} -> "; echo ${x} | ./to-double-speak; done
This is double speak -> TThhiiss iiss ddoouubbllee ssppeeaakk
Hello World -> HHeelllloo WWoorrlldd
AaBbCcDdEeFf -> AAaaBBbbCCccDDddEEeeFFff
```
Thunno 2, 1 byte
I
Attempt This Online! Interleave the (implicit) input string with itself.
Alternatives with J flag:
Rockstar, 82 73 66 57 bytes
listen to S
cut S
O's ""
while S
let O be+roll S*2
say O
Try it here (Code will need to be pasted in)
listen to S :Read input string into variable S
cut S :Split into an array
O's "" :Initialise O as an empty string
while S :While S is not empty
let O be+ : Append to O
roll S : Pop the first element from S
*2 : Duplicate
:End while loop
say O :Output O
><>, 4 bytes
i:oo
Terminates with an error.
Explanation
i # Input one character from STDIN
: # Duplicate it
oo # Output twice
# This keeps looping until there is no more input to read
Thunno J, \$ 3 \log_{256}(96) \approx \$ 2.47 bytes
e2*
e is map, and 2* doubles. The J flag joins the resulting list.
Scratch, 122 bytes
define(s
set[i v]to(1
set[r v]to(
repeat(length of(s
set[r v]to(join(r)(join(letter(i)of(s))(letter(i)of(s
change[i v]by(1
Outputs by modifying a global variable, r, which is automatically displayed (Consensus).
Python 3, 39 38 bytes
lambda s:(j:=''.join)(map(j,zip(s,s)))
Explanation:
lambda s: # a function which takes a string and...
zip(s,s) # zips it with itself,
map(j, ) # joins each tuple,
(j:=''.join)( ) # and joins each string together.
JavaScript (Node.js), 27 bytes
Unsurprisingly not the best JS answer.
Takes array of characters as input since it seems valid for some answers. Output is a string.
s=>s.map(b=>a+=b+b,a="")&&a
D, 57 bytes
Nothing special, just using the std.algorithm's fold function to add a character twice every iteration. There's probably a more efficient way to do this but this one's pretty concise.
import std;auto d(dstring s){return s.fold!"a~b~b"(""d);}
Rattle, 12 bytes
|I=@P[gbb>]`
Explanation
| take string as input
I split string into characters and store in consecutive memory slots
=@ set top of stack to the value of the pointer (i.e. length of string)
P set pointer to 0
[....]` repeat n times where n is the top of the stack
g get character in storage at pointer
bb add character to print buffer twice
> shift pointer right
[print buffer output implicitly]
Wolfram Language (Mathematica), 44 33 25 bytes
-11 bytes
-8 bytes
{#,#}&/@Characters@#<>""&
Mathematica is probably not the best choice for this given its verbose function names, but here's what I managed! The code works by first splitting its input into a list of characters, then it maps an anonymous function over it which replaces each character by a list of two copies. It then combines this list of lists of strings into the final string using <>"" which is an alias for StringJoin, which ignores all list structure.
Rust, 83 46 45 bytes
|x:&str|for c in x.chars(){print!("{}{0}",c)}
I don't like this, but it's not cheating.
- -1 byte thanks to Maya.
Raku, 16 bytes
{[~] .comb Xx 2}
Since the task expressly asked for a function, we're counting the curly braces that turn this expression into one; without them, it will just operate on the current topic $_, so depending on the surrounding code you don't necessarily need them.
~ is the string concatenation operator. Wrapping [...] around it changes it from an infix operator to a prefix function, so everything after it will be joined together into one big string at the end.
.method with no explicit invocant calls the method on the current topic, which here is the unnamed argument to the function. The .comb method splits a string into a sequence of characters (really one-character strings).
str x num repeats the string the given number of times.
X<operator> performs an outer join of its operands and applies the given operator to each pair of items in the result. In this case the right operand is the scalar 2, which just gets paired up with each element in the sequence on the left. So l Xx 2 could also be written, albeit with more bytes, as l »x»2 or l.map: *x 2.
All of the whitespace in the solution is required, unfortunately.
Piet + ascii-piet, 18 bytes (3×6=18 codels)
Technically, we can create a trivial 5 codel (4 ops + 4 no-ops) answer that will never terminate. This non-trivial no-error implementation is a lot more interesting.
rfnf Tk??k?Ttilj t
Try visual Piet online! or Try npiet online!
This improves the answer by @gastropner with 2 codels. Instead of a 5×4 image, this uses a 3×6 image. If you count the number of bytes using ascii-piet, you will find that the previous answer was 18 bytes as well and this is not an improvement but an alternative.
We use the fact that invalid instructions get ignored and got lucky that the whole program is a cycle, just like the previous answer. The main loop is a total of 10 operations, which is an improvement of 1 compared to the previous answer. This improvement was possible by moving the termination point to the right instead of bottom left. In order, the operations are:
1. Output the top value on the stack as character,
2. Pop the top value from the stack (0 for all but the first loop),
3. Push 1 to the stack,
4. Use a `not` operation to turn it into 0,
5. Push the input character to the stack,
6. Duplicate the input character
(OR 0 in case there was no input character),
7. Duplicate it again,
8. Use a `not` operation to turn the top value into
a 0 if there was a (non-null) character and
a 1 if there wasn't,
9. Exit the loop if the top value from the stack is 1,
10. Output the top value on the stack as character.
I don't think it's possible to remove popping 0 from the stack, because you need the 0 on the stack which requires steps 3 and 4. If you remove step 2, your program could technically become 9 steps total at the expense of an ever growing stack, however, loops must always use an even number of codels. With 9 operations you would thus need a 2 codel block to make up for the odd number. If you could get the program to work in 8 steps, that's probably the minimum as I believe you will necessarily need 8 operations: INC DUP DUP NOT OUTC OUTC DP+/CC+ PUSH. Using the same DUP and OUTC commands will be very difficult with so little space, but I think that would be the only option for reducing the size. Lastly, I do think you need the ninth NOT to contrast the sentinel with the input character, because you cannot check for the difference between a successful command and an ignored command without having a different truth value for both.
Note that this also fixes a small bug in the previous answer. The problem with that code is that the Codel Chooser switches between left and right for each iteration. This means that half the time, no 1 is added to the stack and then the previous value on the stack is used in the NOT operation. Then if it reaches the DP+ operation with a 1 (a quarter of the time) and this is the end of the string it will act as if this is the input character and print two <SOH> characters. This bug only occurs for strings of length 𝟤+𝟦𝑘.
C (gcc), 57 bytes (code) + 11 bytes (flags) + N bytes (argv[1])
Note: the flag in question is -Dx=s[1][i]
this code compiles with GCC and Clang
I also had a solution with shorter source code, but including the flags there are more bytes.
main(i,s)char**s;{for(i=0;x^'\0';i++)printf("%c%c",x,x);}
tricks used:
I was able to skip adding int i, char**s by adding the char**s after main is declared, saving 2 bytes. I was also able to set i=0 in the for loop to save a single byte. Using the flag -Dx=s[1][i] saved me 7 bytes.
JavaScript, 39 bytes
alert([...prompt()].map(a=>a+a).join``)
May not be the shortest but at least original.
EDIT
Removed 2 bytes thanks to @emanresu A
Python, 31 bytes
lambda s:"".join(i*2for i in s)
Gives out an actual string instead of a list of characters.
Leaf Lang, 86 bytes
Note: The interpreter does not have a stable release. If I introduce a breaking change I will update this post :)
import"string.lf"argv reverse splitString 0=0=while:o:o:o:o:o o print o print 0=0=stop
Explaination:
0 - push 0 to the top of stack
import "string.lf" - import stdlib's string.lf
argv - add all of argv in order to the stack
reverse - reverse string on top of stack (part of string.lf)
splitString - split a string into chars (part of string.lf)
0 = 0 = - this checks to see if the top value of the stack is a zero
while - runs while the top value on the stack is true (1)
:o:o:o:o - the language has pop as a keyword but :o is 1 char less and can be put side by side.
:o - grab the first letter on top of the stack and store in o
o - push the value in o on top of the stack
print - print top value on stack with no newline
o - push the value in o on top of the stack
print - print top value on stack with no newline
0 = 0 = - check if the next value on the stack is not a zero
stop - required to end while loop
Degolfed:
import "string.lf"
# [0, 'o', 'l', 'l', 'e', 'h']
0 argv reverse splitString
0 = 0 = while pop pop pop pop
: current_char
current_char print current_char print
0 = 0 =
stop
```
makina, 96 bytes
v L>C
v>n0; >n0;
>wv ^
>Ov ^
^i>?g
^IvOC
^ nv
;1<>ppuv
^<<<OOO<
^ >vv
;0nCUv>n1;
T<<
;1nC
It's hard to explain makina code, but basically this goes through each letter of the input and prints it twice.
yup, 9 7 bytes
*{:@@*}
Explanation:
* # Push the first input-character
{ } # Loop as long as the top of the stack is NOT 0 (without popping):
# (the initial `*` is to start the loop)
: # Duplicate the character so there are two on the stack
@@ # Pop both, and print them as characters
* # Push the next input-character for the next iteration
# (which will push 0 if there are no more input(-character)s left)
CellTail, 128 94 90 bytes
N,k&N..,N:1,k,[k];(k,b),N,N:1,k,b;(k,b),c&N..,1|N:1,k,b+[c];(_,a&N..,1)|(1,a&N..,_):1,a,1;
Since both the input and output need to be plain characters it was a bit tricky to prevent spiraling into a endless duplication loop. This version uses 1 as a marker to indicate it's neighbors don't need to split themselves further.
Prolog (SWI), 47 bytes
\[X|A]-->[X,X],\A.
\[]-->[].
X+Y:-phrase(\X,Y).
-8 from Steffan.
Requires the prolog system to use atoms as characters for double quoted strings(Scryer prolog and GNU Prolog do this by default).
:- set_prolog_flag(double_quotes, chars).
The DCG alone is 34 bytes, which is still shorter than the 35 byte version of Thoozee's answer, which is d([A|X],[A,A|Y]):-d(X,Y). d([],[]).
Raku, 21 bytes
{[~] [Z~] .comb xx 2}
{ } : anonymous code block
.comb : yields chars of input string
xx 2 : repeat list of chars
[ ] : reduction metaoperator
Z~ : Z operator and concat operator
: Z is a metaoperator here that zips using ~
[~] : concat zipped list of repeated chars
Fig, \$\log_{256}(96)\approx\$ 0.823 bytes
Y
See the README to see how to run this
Polyglots with Vyxal and does the exact same thing: interleaving the input with itself.
MUMPS, 36 bytes
a(s) f %=1:1:$l(s) w $e(s,%),$e(s,%)
Explanation:
a(s)labels this line as a subroutineawith one parameters.$lis short for$lengthand returns the length of a string.fis short forfor.f %=1:1:$l(s)loops from 1 to$l(s)in steps of 1 with the variable%storing the current value.$eis short for$extract.$e(s,%)gets the character ofsat position%(one-indexed).wis short forwriteand prints the expression that follows it.
Python, 31 bytes
lambda x:''.join(i*2for i in x)
This uses the shorthand for a generator comprehension. It will loop through every character in x and double it. sum won't work for str, so I took the advice from the error and used ''.join.
K (ngn/k), 11 bytes
{,/{x,x}'x}
Quick.
Explanation:
{,/{x,x}'x} Main program.
'x For each character in the string...
{x,x} Duplicate the character twice
,/ Then join each duplicated character together
Alice, 12 9 bytes
/O./
@IZ\
Explanation Flattened
/ Switch to Ordinal mode
I Reads a string from the input
. Duplicates it
\/ Does a U turn and switch line
Z Zip the two strings
O Print it
@ Bye
BRASCA, 6 bytes
As of writing, there's no online interpreter yet.
EDIT: There is now.
,[:oo]
Explanation
<implicit input> - Push STDIN to the stack
, - Reverse stack
[ ] - While non-zero:
:oo - Output the current character twice
GeoGebra, 40 bytes
s="a
InputBox(s
Sum(Zip(S+S,S,Split(s,{"
Input goes in the Input Box.
Just found out about GeoGebra's parentheses/quotation marks/(other stuff I'm missing) auto-complete when pasting in code, really cool.
Rust, 38 bytes
|x:&str|x.find(|c|print!("{c}{c}")>())
This takes advantage of Rust's new formatting features (capturing identifers automatically) as well as the fact that () implements Ord and can be compared to itself. Basically this solution searches the string for a character that matches a predicate, but that predicate outputs the character twice and returns false.
Python 3, 44 43 41 37 25 24 Bytes
I have refactored it a ton and came to this answer:
print(*[x*2 for x in input()],sep="")
then from there I got to
lambda i:[x*2 for x in i]
The TIO doesn't work properly due to it being a function but here it is anyways: The TIO now works thanks to des54321 for their advice:
Here's my other implementation of this challenge with greatly appreciated help from the comments:
print("".join(map(lambda x:x*2,input())))
End result as of 26/05/2022 thanks to everybody's changes lambda i:[x*2for x in i]
Description
It works by separating the script using pythons map function to grab every character in the inputted string then multiplying them by 2 and joining them back together after it is converted to a map using an empty string then joining every element to it.
Thanks to pxeger for suggesting to remove unnecessary spaces, to Wheat Wizard ♦ for suggesting to remove the quotes from the input, to des54321's advice of using f=\ in the header to fix TIO with lambda functions and Nobody's help detecting the unnecessary space in the lambda.
A0A0, 165 150 142 bytes
A0A0
A0C3G1G1A0
A0I1A6V0P0G6C6A0
A0A1G-3G-3A0
G-3
A0A0
C3G1G1A0C3G1G1A0
A0A1G-3G-3A0
G-3
A0A0
C3G1G1A0C3G1G1A0
G-10A0G-10A0
A0A1G-3G-3A0
G-3
The program consists of three loops right after one another. The first loop does the following:
I1A6V0P0G6C6
I1 ; take character input, store in V0
A6 ; append this line to the line six below
V0 ; operand, holds input
P0 ; prints input
G6 ; jumps to six lines below
C6 ; removes all instructions on the six lines below
We duplicate the operand and print instructions a little lower, so we can print it twice. We then jump to there and the last C6 is to get rid of any other instructions that we didn't need afterwards.
The second loop is empty and is constructed from the first loop. The loop is also partially executed so we can enter the loop at the same place each time. This loop will print the character a second time. Because there is a nice G6 instruction inside the copied instructions that will also be executed, we use that as a way to escape from the infinite loop. This is because six lines below is yet another loop.
G-10G1G1
G-10 ; jumps 10 lines up, back to the first loop
G1 ; no-op
G1 ; no-op
This is a simple infinite loop (also partially executed) that takes us back to the first loop. It's padded with no-ops, since the loops needs at least three instructions. Because the first loop contains a C6, any redundant instructions in the second loop will be removed once we get back to the first loop.
Edit: Optimized by 15 bytes. I misunderstood the default loop template I make use of in the code. I was under the impression that the amount of G1 and G-3 instructions on line 2 and 4 of the loop resp. needed to match the amount of instructions inside the loop. This is not the case, you only need two of them (although more also work, as long as each line has an equal amount of them). This change removes these extra instructions.
Edit 2: Optimized by 8 bytes. Because of edit one, it turns out that there's actually no minimum of three instructions in the loop. This allows us to drop four instructions (not two, since the loop at the bottom is partially evaluated), totalling eight bytes.
Rust, 114 bytes
fn main(){let mut b=format!("");std::io::stdin().read_line(&mut b).unwrap();for l in b.chars(){print!("{}{0}",l)}}
Rust is not a great golfing language given its focus on explicitness, but here's an answer anyway!
Normally one allocates a string using String::new(), but format!("") is two bytes shorter. I also use that the print macro can accept the index of the variable to print, so I avoid writing print!("{}{}",l,l), saving one byte.
C (clang), 43 chars
The function f is double speaking its string input.
f(char*a){*a&&f(a+!!putchar(putchar(*a)));}
Edit : saved 1 char by reusing the putchar output to eliminate a division, by ceilingcat.
Javascript(Node.js), 64 57 55 bytes
-7 bytes thanks to Radvylf Programs
-2 bytes thanks to pxeger
This is my first code golf answer, so I know this could be improved.
s=>{eval("e='';for(var i in s){e+=s.at(i).repeat(2)};e")}
TI-Basic, 52 37 39 bytes
For(I,1,2length(Ans),2
sub(Ans,1,I)+sub(Ans,I,1-I+length(Ans
End
Ans
Input is taken in Ans. Output is stored in Ans and displayed.
dotcomma, 15 14 bytes
[[],][.[[,],]] code
[[],] push 0 to the queue
[. ] while next block is non-zero
[[,],] pop from the queue and push it twice
dotcomma, 48 bytes
[[],][.[[[,],],]][.[,]][,[,[,.[[[,][,]][,.].]]]]
<script src="https://combinatronics.com/Radvylf/dotcomma/master/interpreter.js"></script><script src="https://code.jquery.com/jquery-3.5.1.min.js"></script><script>$(document).ready(function () {$("#btnInterpret").click(function () {$("#txtResult").text(interpret($("#txtCode").val(), $("#txtInput").val(), $("#lstOutputAs").children("option:selected").val()));});});</script><style>.textBox {background-color: white;border: 1px solid black;font-family: Courier New, Courier, monospace;width: 100%;}</style>Code: <textarea id="txtCode" type="text" class="textBox" style="height: 200px">[[],][.[[[,],],]][.[,]][,[,[,.[[[,][,]][,.].]]]]</textarea><br />Input: <textarea id="txtInput" type="text" class="textBox">Double speak!</textarea><br /><input id="btnInterpret" type="button" value="Run" />Output as: <select id="lstOutputAs"><option value="true">String</option><option value="">Number array</option></select><br />Result:<br /><div id="txtResult" class="textBox" style="overflow-wrap: break-word"></div>
Code:
[[],] insert end marker (0) [.[ while characters left [[,],], copy each character 3 times ]] [.[,]] go to first 0 [,[,[, delete copies of 0 and first character .[[[,][,]][,.].] delete every third character until we reach 0 again ]]]
Mascarpone, 12 bytes
[,:..:!]v*:!
Pretty simple.
[ ]v* Push the following as an operation to the stack.
,:.. Input a character and output it twice.
:! :! Duplicate the operation and run it so that it loops.
Lexurgy, 28 bytes
The "canonical" way of duplicating characters (gemination in linguistics terms) in Lexurgy: capture a character and an empty string, and replace both with itself. The $$ matches the space literal between words on a newline-separated input.
a:
[]$1 *=>$1 $1
$$=>$$ $$
Binary Pi Calculus, 5 bytes
0x37 0xA7 0xB2 0x7B 0x00
I don't know if there is an interpreter for BPC. If there is one, I'd appreciate if someone let me know.
Explanation
0x37 0xA7 0xB2 0x7B 0x00
00110111 10100111 10110010 01111011 00000000
0011011110100111101100100111101100000 000
001 Run the following on an infinite number of threads:
1011110 Read from free channel 0 into bound variable 0
100 1100 Write bound variable 0...
11110 ...to free channel 1
100111101100 Do so again
000 End the process
BPC technically does not have I/O capabilities. Instead, I use the global names 0 and 1 for STDIN and STDOUT, respectively (these numbers are, incidentally, the file descriptors for STDIN and STDOUT in most 'nix operating systems)
Python 3, 31 24 bytes
-7 bytes by returning a list of characters instead of a string
lambda s:[c*2for c in s]
Returns a list of characters instead of a string.
CLC-INTERCAL, 85 bytes.
DO;1<-#1DOCOMEFROM#2DOWRITEIN;1(1)DO:1<-;1SUB#1DDOCOMEFROM':1~:1'~#1(2)DOREADOUT;1+;1
Copy and paste to try it online!
With comments, though I don't know its necessity
DONOTE length of array
DO;1<-#1
DOCOMEFROM#2
DONOTE perform getchar() for a time to store to ;1SUB#1
DOWRITEIN;1
DONOTE EOF: zero; otherwise: at least 65536
(1)DO:1<-;1SUB#1
DONOTE die here
D
DONOTE ':1~:1'~#1: zero if EOF one otherwise
DOCOMEFROM':1~:1'~#1
DONOTE putchar() twice
(2)DOREADOUT;1+;1
Minim, 73 Bytes (44 w/o Output)
Program is run as follows:
C:\Users\chris> minim -a "Double speak!" -f golf.min
Arrays of values, and subsequently strings, cannot be returned or passed around to statements, and the interpreter uses only index 0 for a 'return/exit value'. Therefore I've opted to just print the modified string to the console.
[0]=L*2+1.[1:]=A.[[0]]=[[0]--/2]._^![0].C=1.[0]=2.$<[[0]++]._^![[0]].C=5.
With whitespace and comments:
;;; Insert string into memory and modify it
[0] = L * 2 + 1. ; Set index 0 to twice the length of the program arguments plus 1
[1 :] = A. ; Insert program arguments at index 1
[[0]] = [[0]-- / 2]. ; Set index of index 0 to half of memory at index of index 0, and decrement index 0
_^ ![0]. ; Skip the next statement if index 0 is 0
C = 1. ; Set program counter to 1
;;; Output modified string (no string/array return)
[0] = 2. ; Set index 0 to 2.
$< [[0]++]. ; Print index of index 0 as Unicode, and increment index 0
_^ ![[0]]. ; Skip the next statement if index of index 0 is 0
C = 5. ; Set program counter to 5
Without printing it, the program goes down to just 44 bytes.
[0]=L*2+1.[1:]=A.[[0]]=[[0]--/2]._^![0].C=1.
The modified string is now just in memory.
Vyxal, 4 2 bytes
2•
Removed implicit input and output. Thanks @emanresu A
Doesn't beat Y but works nonetheless.
GolfScript, 7 6 4 bytes
{.}%
[Try it online!][TIO-jyx60w31]
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
{ } code block
. copy the top item of the stack
% array map
Python, 67 bytes
from itertools import*
print(*chain(*[i*2for i in input()]),sep="")
Vyxal, 1 byte
Y
Yet another trivial answer. Y interleaves the input string with itself. It’s good that Vyxal can tie with Jelly and beat 05AB1E in matters of triviality.
Dis, 3 bytes.
}{{
How it works
} ( a=getchar;if a==EOF a=59048;)
{ ( if a==59048 exit; else putchar a%256; )
{ ( again)
( then keep program counter+=1 until 59048 where each cell from i=3 to 59048 is NOP;
then pc=0 if pc is 59048)
Zephyr, 89 bytes
input s
set i to 1
set o to""
while""<s[i...i]
set o to(o+s[i])+s[i]
inc i
repeat
print o
Explanation
Oh. My. Goodness.
I spent 20 minutes convinced this challenge wasn't possible in Zephyr. All the language design choices that I made 11 years ago came back to bite me:
- There is no way to get the length of a string (not a design choice, I just didn't implement anything).
- The
printstatement adds a trailing newline by default. Suppressing the trailing newline with...adds a space instead. - The concatenation operator
|also puts a space between the two values.
But a couple of things went right:
- String slicing exists, and doesn't throw an error if the indices are out of bounds.
- You can concatenate any value to a string using the
+operator. In hindsight, I'm not sure why I thought this was a good feature, but there it is.
And so:
input string
set index to 1 # Zephyr uses 1-based indices
set output to ""
# Loop until index is out of bounds, at which point the string slice returns empty string
while "" < string[index...index]
set output to (output + string[index]) + string[index]
inc index
repeat
print output
MineFriff, 4 bytes
:oo~
No, I totally didn't forget to add input to MineFriff. You have to supply the string to double speak in the header, which can be generated using this Vyxal snippet.
Explained
:oo~
: { duplicate the top of the stack }
oo { print it twice }
~ { back to the start of the line }
Arduino, 113 bytes
#define S Serial
int c;void setup(){S.begin(300);}void loop(){if(S.available()){S.write(c=S.read());S.write(c);}}
Pretty simple. If there are unread characters from the serial input, write them twice.
Explanation:
#define S Serial /* This abbreviation is worth it if it's used more than twice */
int c;
void setup() {
S.begin(300); // begin serial communications
}
void loop() {
if (S.available()) { // if there are bytes to be read
S.write(
c = S.read() // read, store, and write it
);
S.write(c); // write the stored value
}
}
Pxem, filename: 17 bytes.
\001 is such a byte of binary.
.w.o.o.i.c.c\001.+.a
How it works
Since this program is simple, here is verbose explaination.
XX.z
# while stack is empty or popped value is not zero; do
# NOTE stack is initially empty
.a.wXX.z
# if not empty; then pop to output its character; fi
# if not empty; then pop to output its character; fi
.a.o.oXX.z
# getchar and push its codepoint value
# NOTE EOF is -1
.a.iXX.z
# if not empty; then duplicate; fi
# if not empty; then duplicate; fi
.a.c.cXX.z
# push one
# if stack has two or more items; then pop twice and push their sum; fi
.a\001.+XX.z
# done
# NOTE reaching to end of filename implicitily terminates the program
.a.a
SM83, 8 bytes
Input string pointer in de, output string pointer in hl
1A 13 23 B7 C8 23 18 F8
dbl:
ld a,(de) // 1A read
inc de // 13 and increment
ld (hl+),a // 23 write and increment
or a // B7 cheap test for zero
ret z // C8 return if zero
ld (hl+),a // 23 write and increment again
jr dbl // 18 F8 loop
<>^v, 29 bytes
.—""?§0 27 0«0 82!=0_~~?(___|
Explanation
.—""?§0 27 0«0 82!=0_~~?(___|
. Input string, push to stack
— (not a minus) Reverse the string
"" Push empty string to stack
? Swap top two elements
§ Split top of stack (now the user input) with second element of stack (`""`)
0 Push 0
27 Push 27
0 Push 0
« Goto ; redirects program to the `|`
| Reverses instruction pointer direction, now going left
_ Pop stack
_ Pop stack (again)
_ For the third time, pop the stack
) Decrement top of stack
? Swap top two elements
~ Print top of stack without newline
~ Print top of stack without newline (again, for the double character)
_ Pop stack
0 Push 0
= Execute next instruction only if top two elements of the stack are equal
! Exit, executed only if the top two elements of the stack are equal
82 Push 28 (pointer is going left, so literal 82 -> value 28
0 Push 0
« Goto _
_ (Loop goes on, go back to the first "Pop stack")
It first reverses the string, then splits it into characters. Then it goes into a loop reverse-iterating the characters and printing them twice, popping them at the same time, each time decrementing the "characters left" counter which is at the top of the stack, and exits when "characters left" is 0.
Mostly inspired by this other answer I made
run online (> is the prompt, cannot remove it)
Taxi, 390 342 335 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 i.Pickup a passenger going to Cyclone.Go to Zoom Zoom:n 1 l 3 r.Go to Cyclone:w.[C]Pickup a passenger going to Post Office.Switch to plan B i.Switch to plan C.[B]Go to Post Office:s 1 l 2 r 1 l.Switch to plan A.
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.
[any character after end_loop is fine]
[Duplicate first character left]
Pickup a passenger going to Cyclone.
Go to Zoom Zoom: north 1st left, 3rd right.
Go to Cyclone: west.
[Pickup character twice]
[two]
Pickup a passenger going to the Post Office.
Switch to plan end_loop if noone is waiting.
Switch to plan two.
[Prints characters or crashes program, you can't drive that way]
[end_loop]
Go to the Post Office: south 1st left, 2nd right, 1st left.
Switch to plan loop.
Comment
It does not even matter whether we tank at Zoom Zoom or Fueler Up, both are 335 bytes.
By tanking at Fueler Up we pay so much that we don't earn enough and are out of gas for string of length 86 or more. However, even tanking at Zoom Zoom does not allow to drive infinitely, it probably stops at strings of a length around 129, I didn't test or solve this because it's an old answer.
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 i.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 3 l.[C]Pickup a passenger going to Post Office.Switch to plan B i.Switch to plan C.[B]Go to Post Office:s 1 l 2 r 1 l.Switch to plan A.
[MashedPotatoes], 315 bytes
synchronized(0.0f){WHILEstd::ignore=`uniq-c`s/nullptr//gWENDgoto++i;(formatt"case__dict__of{_->OUTPUT=void(0)}def$ARGV(--help)usestrictqw/*read-eval*/;endgoto<>;gotoObject;defstd::ignore(--help)guardnullptrend(formatt"procFS{STDERR}{SETLOCAL()import$ARGV;}std::cout<<--help<<std::endl;goto0.0f;goto++i;")goto<>;")}
This is not short, by any means. But I've wanted to try and use MashedPotatoes for something, since the language is so odd. So it might be possible to shorten the code, but it's the sort of language where I'm relieved if I get something to work. :)
It's not available on TIO, so here's a link to the Esolang entry for the language. https://esolangs.org/wiki/MashedPotatoes There's a link the GitHub entry with the code on the page.
And there's one caveat about the interpreter... I submitted a PR to the repo to make it possible to handle EOF when reading character input, and this code relies on that enhancement. The maintainer merged it today (meaning 4/17/2021) so if you may need to refresh your copy if you pulled it previously.
I think a brief explanation of some language quirks are probably necessary first... There are 3 registers ^A, ^C, ^E, three stacks 0, 1, 2, two triggers A, B, and three labels 0, 1, 2 available.
The constants STDERR, $[, ~uniq -c~ (where I've used ~ to replace backticks since I cannot figure out how to make backticks work inside backticks) references registers ^A, ^C, ^E respectively the first time they appear in the code. Then they change to the next register the next time they are used. Meaning STDERR evaluates to the
value of ^A the first time it appears in the code, to ^C the second time, etc...
Trigger A is referenced by the constants use strict qw/LABEL/;, SETLOCAL LABEL, import LABEL;, CFLAGS=LABEL, \emph{LABEL}, ~cat LABEL~ (again ~ used in place of a backtick here) cyclically. Meaning the first occurence of trigger A in the code will be
use strict qw/LABEL/;, the second time will be SETLOCAL LABEL, etc... And LABEL is replaced the target label.
Similarly trigger ^B is references by the constants s/LABEL//g, OUTPUT = LABEL, guard LABEL, lambda: LABEL, """LABEL""", also in the same cyclical manner.
Label 0 is referenced by the symbols 0.0f, ++i, <>, Object cycically.
The cyclical reference names for label 1 are std::ignore, nullptr, __dict__, void(0).
And the label 2 references are $ARGV, *read-eval*, FS, ().
A better description can be found on the Esolangs page for the language.
And next, the code...
synchronized (0.0f) {
This just assign the label 0, the value 1 since the ( is on line 1 of the code.
WHILE std::ignore = `uniq -c` s/nullptr//g WEND
Increments the value of register ^E.
goto ++i;
Shifts the values of the registers, effectively ^A -> ^E -> ^C -> ^A
(format t "
Loops while ^C is greater then 0
case __dict__ of { _ -> OUTPUT = void(0) }
Reads one character from STDIN into ^A
def $ARGV(--help) use strict qw/*read-eval*/; end
Pushes the value of ^A to stack 0, since ---help evaluates to 0
goto <>;
goto Object;
Shift the registers twice.
def std::ignore(--help) guard nullptr end
Pop the value of stack 0 into ^A, the result of the the last 4 actions is effectively ^C = ^A
(format t "
Loop as long as ^C > 0, effectively if not EOF { ... } since EOF is codepoint 0.
proc FS {STDERR} {
Code block for output operations
SETLOCAL ()
Print the value of ^A, mapping the codepoint to a character
import $ARGV;
Repeats the same, meaning print ^A a second time
}
End of output code block
std::cout << --help << std::endl;
Set ^A to zero.
goto 0.0f;
goto ++i;
Shift the registers twice, effectively sets ^C to 0 to cause the loop to exit
")
End of the print loop, which will never run more then once since we explicitly set ^C to 0 to prevent that.
goto <>;
Shift the registers, sets ^C to the last codepoint read from STDIN, will be 0 on EOF.
")
End of the outermost (format loop, will decrement ^C and compare against 0, so if the read got any character the loop will repeat.
}
End of synchronize code block.
V (vim), 5 bytes
òylpl
òylpl
ò " loop until error
yl " yank character under cursor
p " paste it
l " move right
Alt:
V (vim), 5 bytes
òälll
ä{motion} is a synonym for y{motion}P which is almost what we want but pastes backwards rather than forwards, so we need another l here, tying the vim-ier first solution.
Equivalent vim version:
Vim, 11 bytes
qqylpl@qq@q
Ly, 7 bytes
ir[:oo]
Oddly enough, this turned out to be similar to the Brainfuck answer someone else posted...
i - reads in a line, adds each character to the stack as a codepoint
r - reverse the stack
[ ] - a "loop while stack not empty" construct
: - duplicate the top of the stack
o - pop the top of the stack and print codepoint as char
o - again...
Unlambda, 11 bytes
``ci`c`|`@|
On its own, `|`@| is an identity function with a side effect of reading a char from the input and printing it twice. `ci is a call-with-cc trickery that ends up applying its argument to itself, hence `c`|`@| is the same with the above-mentioned side effect; all in all, this will set up a loop.
(The solution is memory inefficient, as each iteration will create a new continuation, hence the space used will be linear or quadratic in the length of the input, depending on the implementation. This can be fixed at the expense of adding two more characters: ``ci`d`c`|`@|.)
Labyrinth, 9 8 bytes
,
.:@
:
Wins over Jonathan Allan's answer.
How it works
, Start at the first meaningful instruction; push a char from stdin
: Duplicate; on EOF, top is -1 so turn left and exit (@)
otherwise, top is positive (printable ASCII) so turn right
.:. Pop-print as char, dup, pop-print as char. Top is still the input char
: Duplicate; turn to (,) since top is nonzero
, This is a dead end so it runs again from the start, until EOF
Kotlin, 48 35 bytes
35 bytes from 48 bytes thanks to @user
{it.map{"$it$it"}.joinToString("")}
Not much to it, just that it.map() returns a CharArray so you have to joinToString() it.
Kotlin Playground Link(Would've been TIO but TIO has issues with kotlin.)
Whispers v1, 38 bytes
> Input
>> L+L
>> Each 2 1
>> Output 3
Squeezed pseudo code:
>> Output ( Input.map( c -> c + c ) )
Explanation:
As usual in Whispers, the last line is executed first by default:
>> Output 3
This line outputs the result of line 3:
>> Each 2 1
Here we expect line 2 to be a function and line 1 to be an array. It returns the array specified in line 1, whose elements were modified by the function in line 2. Let's look at this array first:
> Input
Takes the first line of the input. So we get an array of characters.
Now line 2:
>> L+L
L is an argument from the Each statement in line 3. Since we are working with strings, L is returned concatenated with itself.
So the squashed pseudo-code is:
>> Output ( Input.map( c -> c + c ) )
naz, 34 32 bytes
2x1v1x1f0a0x1x2f1r3x1v1e2o2f0x2f
Works for any null-terminated input string.
Explanation (with 0x instructions removed)
2x1v # Set variable 1 equal to 0
1x1f0a # Function 1
# Add 0 to the register
1x2f1r3x1v1e2o2f # Function 2
# Read a byte of input and goto function 1 if it equals variable 1
# Otherwise, output twice and call function 2
2f # Call function 2
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;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/(-,+*)('h%$d"ca}|_z\rqYYnsVTpoRPledLLafIGcbE`BXW??TY<:V97S64P31M0.J-+G*(DCB%@?"=<;|98765.3210p.-n+$)i'h%${"!~}|{zyxwvuXVlkpSQmlOjLbafIGcbE`BXW??TY<:V97S64P31M0.J-+G*(D'%A@?"=<}:98y6543,1r/.o,+*)j'&%eez!~a|^tsx[YutWUqjinQOkjMhJ`_dGEa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LKP31M0.J-+GF)D&<;@?>!~;:98765.3trrq.-,+*)('~g$#"c~}|{z][wpotWUqTRnQOkNLhgJeG]\aDB^]@[=SRW:8T75Q42N1/..CHGF)(CBA@?>=<5|98765u-210/o'n%*)(!&}$eccbw|_zyx[vuWsVTSShmlOMibafIGFF[`_B]?UTY<:V97S6433HML/-IBAF)'C&$@#!=~|:{y765vu,1r/.-nl$#(igff{"!b}_uty\ZYYnsrUSohglOMiLJfIGcFD`CA]@>Z=;W:877LQPO21LE.,,+FE>C&A@?"=<|{{276wu3,+0qonn%*)j'g}|#db~a_{^\x[YuXVrUSoRPlOMihgJIdc\aD_^]@[Z<XW:U7MLQ42N1/K.,H+)E(&B%#?"~<}{9zxww.321rq.-,%ljji&%$#z!b}|{^yxwYYnsrUSohglOMiLJfeHcE[Z_B@\?=Y<:V97S64P31M0.J-+**?DCB%$?>=<5:{876w432rr).-n+k#"'hf$#d!awv{^\xwZXtmlqTRnQOkNLhKIeHFbEC_B@\?=YXW:9TSRQPI200/JIHGFE>C&A@#!76||3876wv3210/.',m*)j'&%eez!~a_{tsx[YXXmrqTRngfkNLhgJeG]\aDB^A?[><;;PUTS65PONMLKJC,**)DCBA@?>=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;9U8655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xRQ
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.
(C+[C])%94 |
Description | Pseudocode | Op |
|---|---|---|---|
| 4 | Set code pointer to the value pointed to by the current data pointer. | C = [D] |
i |
| 5 | Output the character in A, modulo 256, to standard output. |
PRINT(A%256) |
< |
| 23 | Input a character from standard input and store it in A. |
A = INPUT |
/ |
| 39 | Tritwise rotate right. | A = [D] = ROTATE_RIGHT([D]) |
* |
| 40 | Set data pointer to the value pointed to by the current data pointer. | D = [D] |
j |
| 62 | Tritwise "crazy" opertaion (see table below). | A = [D] = CRAZY_OP(A, [D]) |
p |
| 68 | No operation. | NOP |
o |
| 81 | Stop execution of the current program. | STOP |
v |
An image of the table can be found here
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
VBScript, 88 bytes
s=wscript.arguments(0):k=""
for i=0 to len(s)-1
n=mid(s,i+1,1)
k=k&n&n&" "
next
msgbox k
First argument as the string
Python 3, 31 bytes
lambda s:"".join(c*2for c in s)
-4 bytes thank you to Redwolf Programs for suggesting lambda method.
Lua, 31 bytes
print(((...):gsub(".","%1%1")))
Explanation
... is the multi-return formatted version of the arg table. We encase it in parentheses here so that it only returns one value (the first).
gsub() is the global substitution function, it takes a pattern and returns a string with every instance of it replaced according to the second parameter.
"." is a pattern matching any single character.
"%1%1" is a pattern which is used as the second parameter to gsub. %1 means the first case, which is the whole match in this instance, so it repeated the entire match twice.
Python 3, 67 64 bytes
t=input()
for i in map(lambda x:x[0]+x[1],zip(t,t)):print(end=i)
Marbelous, 26 bytes
..@0
..00
..]]\/
../\
@0../\..
Marbelous is a language based on marble machines
@n(nfrom0toZ) is a portal which teleport the marble to another portal with the same value00-FFinitiate a marble with this value]]read one byte of input into a parsing marble\/is a trash can/\create a duplicate passing marble to it's left and right..is a noop- marbles going out of the machine from the bottom are implicitly outputed
Add++, -i 8 bytes
L,dzbFBJ
This creates a lambda (L) that:
- duplicates the input string (
d) - zips the two strings together (
z) - flattens that list (
bF) - and joins it together (
BJ)
Finally, the -i flag auto executes the lambda.
Arn, 5 bytes
|{|}\
Since this is <6 bytes I can't compress it
Explained
\ Fold with...
| Concatenation after...
{ Mapping...
| And concatenating _ and _
} End map
Fold's required input is automatically assumed to be _ (initialized as STDIN). Type casting automatic, output automatic.
Kite, 111 94 79 bytes
Really surprised that nobody has used Kite before on CGCC... it's a really easy to learn language.
method d(a)[(a|split("")<-method(a)[a+a;])<|method(a,b)[a|str*a|bool|int+b;];];
Test suite:
method d(a)[(a|split("")<-method(a)[a+a;])<|method(a,b)[a|str*a|bool|int+b;];];
(d("abc"))|print;
(d("Double speak"))|print;
x86-16 machine code, IBM PC DOS, 16 10 8 bytes
Assembled byte xxd dump
00000000: b401 cd21 cd29 ebf8 ...!....
Unassembled listing:
B4 01 MOV AH, 01H ; DOS read char from STDIN (AH=01)
CD 21 INT 21H ; read char into AL (echoes input)
CD 29 INT 29H ; write char in AL to console again
EB F8 JMP -8 ; continue looping until break
Standalone PC DOS executable. Input from STDIN, output to console.
Interactive console input:
Input by pipe:
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.
Brainetry, 85 bytes
Golfed version inspired in the program that comes after:
a b c d e f
a b c d e f g h
a b c d e f g
a b c d e f g
a b c d e f
a b c d e f g h i
To try this online, head over to this link, copy&paste the code in the btry/replit.btry file and hit the green "Run" button.
Golfed from this program:
This is almost a cat program.
This is a double speak Brainetry cat program:
For every single character of input gotten
I am supposed to output two characters.
Doing this in Brainetry is easy.
Can I get a more difficult challenge, please ?
Fortran (GFortran), 71 65 bytes
character(99)a
read*,a
print*,(a(i:i),a(i:i),i=1,len_trim(a))
end
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
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
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.
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]
'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.
Burlesque, 2 bytes
)J
) # Map (implicitly explode and apply to each character then concatenate)
J # Duplicate
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}}
For every item in the list, return every item concatenated with itself.
Acc!!, 42 bytes
N
Count i while _/32 {
Write _
Write _
N
}
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).
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.
Keg, 11 7 6 4 3 bytes
(⑩,
Explanation
( # Repeat length of stack times:
⑩ # Print without popping the top of the stack
, # Print with popping
GolfScript, 4 bytes
{.}%
Takes an input, which it treats as a list of characters, and maps . (push top item of stack to stack) over them.
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.
Binary Lambda Calculus, 10 bytes
8446 0016 c25b 3fdf 9ade
This program was on this page and was known as a ``stuttering'' program.
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
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!
Wolfram Language (Mathematica), 13 11 bytes
-2 thanks to LegionMammal978
#~Riffle~#&
Takes and returns an array of characters.
Clojure, 25 bytes
(fn[s](apply str(map #(str % %)s)))
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.
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.
Hexadecimal Stacking Pseudo-Assembly Language, 60 bytes
000000100000420000400000420000400000030000040000140000010000
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
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)
Haskell, 15 14 13 bytes
(>>=(<$"dd"))
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.
Backhand, 5 bytes
i}o:
(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
Which doubles up on every character.
Forth (gforth), 39 bytes
: f bounds ?do i 1 type i 1 type loop ;
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
MathGolf, 2 bytes
I hope this isn't a duplicate. (Great, it isn't.)
_^
Explanation
_ Duplicate the implicit input
^ Zip
Seed, 6013 3942 3884 3865 3848 bytes
6 2686150228553910251590139707025615036563204497823963635717768129239771871066022173506550480510882628259267028226290577985584582829987099606110915656117177113555095646841841520224800333754793732176561479800611856258812006670385981709167679328497862503284773114717364645850756926464567857029605682209030697372493435852024478962025612141035167904456425050991742516020282696732660004824569723936406080643638019715421991278634074220365586727498681650073989748857985341022350116695714407041551609933358182688736747622670056818175549484918971558384479903673900409406866275258032866680967195428439907751537922194839977711106739550525066186108781580088916582559490041917035011328862266125578018990106393872489460844458091217404944194309597162769266585917996079831048944050703695352212652362891425728346891039020051565145149143668695374506752075410956647268061596926723805877631732070244839345640289062870487268706837056753112890753688530410829624567367052492603150395779619674714389456447573342335882718419424356991739625084740814435581409670174841935167450868967735568432921607395284483532735870628809137816139721467391760314297120583388009684979379888771619327969950939260709632318979448755571394507744993723267176377451465261335636767345281382139780890626858048062851714445255458413414708836044457819560626602471881203745677166851290194466534044374122781840150694963232713079984019097616802988558052961445185981197848860688635007868494303883280609553158126926303057368716954797175868772233997584782178460308584468311133667562020523260687787209651365697360075036255149184531675013585317549831215044187699501112214237282761452176427542227751840469500783022037518267131004723958694850409020207947539046371030202918430731468837057173037358435898981729128093138565524861044307737736772778645659866179416374742499528142506977571896833797572787168504674372995624869224644028121889021513694674680344413147327217671463636201883832593707987630471763158950694907193475270346642656464131212900528377257996057522592531063490286796434946290829640562975054259249630102041301990094261151488784971084438450904697283402436878185751193256803412549504172175692725366543545573099651580644132336272302990268431569623087644930350666119986012078396755208814027614451748455718916151950218835893255721018309717807161101069849247670957963270760531996609510342178009605381013854568528344071028665101709824510991652144229895556116304356971449229862349660751509158124118556805449346752918775201366378708970673708268140336609704879631200464020207189960217784283188350457711700181561855735903701439931161728546207607766764248018356183768557244013532032616392458312600465372655052565572757979232509950076857757257164261786986456779565081319671440867797151240096925123970490604003172676471092543424462070540303172987644037832692737644573481399927217285232015082118420498058022229538934735831710860610342762500071914715742707928060606416262583307855509796730058097681208691054336064995992598081644175617375019325706441005506100489323794725547244923204524790583484243672718647866979116309868261348266944902049457094368284266044502218232850494065571536043568039093446786891928597439310947971461490128765873399872574753055564655381318395939745692438909430171644009177696549501234738931977436030245682360974103741227416811200635596942701451202333113537361407624672328798572271366897755165037017879673502748767425083758652376018772700583221474572236166246539494675416322678094399996691972837962509574037110004298629947088012862552029152119412750923308070223808629424081676003170951500587426197322368913565250353332410276730344732325753114510178069340400741671217608323179698501977213623893949006870978691284571486316780769512681865771113879654002525802085758553029765815927252866913455193686303619992165147682671351400793392238437682055370542229871989802092530537034276944154276536658348210
Perl 6, 13 11 bytes
{S:g{.}x=2}
Anonymous code block that takes a string and returns a string by replacing each character with twice of itself.
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
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.
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.
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.)
K (ngn/k), 5 bytes
,/2#'
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!!"
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]);}
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;}
C#, 104 bytes
public class P{public static void Main(string[]a){foreach(char c in a[0])System.Console.Write(c+""+c);}}
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");}
Pepe, 19 bytes
REEerEErReEeReEeree
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
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
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.
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).
character(99)S;read(*,'(A)')S;do i=1,len_trim(S)
write(*,'(A)',advance="no")S(i:i)//S(i:i);enddo;end
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.
Lua, 32 31 bytes
print(((...):gsub('.','%0%0')))
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
)
)
)
```
Cubix, 9 bytes
oU;?Av/@o
Mapped onto a cube
o U
; ?
A v / @ o . . .
. . . . . . . .
. .
. .
APut all the input onto the stackvRedirect around the cube and start of the print loopo?Output the character for the stack value and test value@If test is negative (EOI), haltUo;/If test is positive, u-turn to the left, output character again, pop from stack and reflect onto the start of the print loop.
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.
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|`!|`!|
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
C (clang), 60 50 bytes
gets(s);while(s[(int)i])putchar(s[(int)(i+=0.5)]);
Saved 10 bytes Thanks to Peter Cordes
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
PHP, 59 bytes
-1 bytes by @manatwork
function($g){foreach(str_split($g)as$v)$e.=$v.$v;return$e;}
Full program , 44 bytes
foreach(str_split(readline())as$v)echo$v.$v;
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 inargv.0, which is the first argument given when calling therender()method.
Due to this, you can pass an array of characters or a simple string, and it will loop through it.
Theas charis optional and the default variable name is_.
Whitespace is optional{@echo char, char}
Outputschar. 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.
MathGolf, 1 byte
^
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.
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;
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))
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.
K (oK), 5 bytes
Solution:
,/2#'
Explanation:
,/2#' / the solution
2#' / 2 take (#) each
,/ / flatten
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.
Retina 0.8.2, 6 bytes
.
$&$&
Try it online! Not guaranteed to work with unprintable characters. Previous 8-byte version worked with newlines:
s`.
$&$&
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")
Java 8, 27 bytes
s->s.replaceAll(".","$0$0")
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.
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
4, 21 bytes
3.6000180070050050094
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
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.
JavaScript (Node.js), 22 bytes
Takes input as an array of characters.
s=>s.flatMap(c=>[c,c])
JavaScript (ES6), 26 bytes
Takes input as a string.
s=>s.replace(/./gs,c=>c+c)
Alternate version suggested by @PabloLozano:
s=>s.replace(/./gs,'$&$&')
Doing it the recursive way is also just as long:
f=([c,...s])=>c?c+c+f(s):s
brainfuck, 6 bytes
,[..,]
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:
+[,..]
Jelly, 1 byte
ż
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.
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).
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.
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;}
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
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
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).)
C (gcc), 62 41 bytes
f(char*a){for(;putchar(putchar(*a++)););}
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 ;)
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
Pyramid Scheme, 229 218 213 bytes
^
/l\
/oop\
^-----^
-^ ^-
/[\ /]\
^---^---^
-^ / \ -^
^-/out\ / \
-^-----/set\
-^ ^-----^
-^ - /+\
/ \ ^---^
/arg\ /1\ -
^-----^ ---
-^ -
-^
/ \
/arg\
-----^
/1\
---
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\
---
PHP, 74 bytes
function doubleSpeaker ($s) {
return preg_replace('/(.)/', '$1$1', $s);
}
Zsh, 29 bytes
s=(${(s::)1})
<<<${(j::)s:^s}
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.
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
kavod, 16 bytes
*>1+8?99.1-#<#0.
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.
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 and5f(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 the5f, if applicable).
Minkolang v.0.15, 7 bytes
od?.dOO
Explanation
od?.dOO
o take one character of input
d duplicate top of stack
?. terminate if its 0
dOO duplicate and output twice
!@#$%^&*()_+, 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
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
><>, 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
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
Labyrinth, 11 bytes
,:
"~~."
@
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
Retina, 4 bytes
$<&
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).
PowerShell, 29 23 21 bytes
-6 bytes thanks to Andrei Odegov
-2 bytes thanks to mazzy
-join($args|%{$_+$_})
Takes input via splatting, essentially making it an array of chars
Forth (gforth), 40 bytes
: x 0 ?do dup c@ dup emit emit 1+ loop ;
A byte can be saved by removing the ?, but that will break the handling of zero-length input.
Befunge-93, 8 bytes
~:1+%:,,
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.
Jelly, 1 byte
Ḥ
A full program printing the result.
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
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.
Boy, golfing in SPL does seem ugly...
- Lots of bytes saved after Veskah pointed me to the SPL golfing tips. :-)
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.
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.
Spews warnings and terminates with an error. Deal with it.
Z80Golf, 10 bytes
00000000: cd03 8030 0176 ffff 18f6 ...0.v....
Corresponding assembly:
start:
call $8003 ; input
jr nc, no_halt
halt
no_halt:
rst $38 ; nop-slide to $8000 - output
rst $38
jr start
Brain-Flak, 48 bytes
([]){{}({}<>)<>([])}{}<>([]){{}(({}<>))<>([])}<>
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
([]<>){({}[()])<>(({}))<>}<>
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
{({}<>)<>}<>{(({}<>))<>}<>
Brain-Flueue, 14 bytes
{(({}<>))<>}<>
C (gcc), 40 bytes
f(s,t)char*s,*t;{while(*t++=*t++=*s++);}
Assumes t is a buffer which is large enough to store the output.
Probably not standard-conforming, but it works on TIO.
jq (-Rrj), 12 characters
(./"")[]|.+.
Sample run:
bash-5.0$ jq -Rrj '(./"")[]|.+.' <<< 'D0uB!e'
DD00uuBB!!ee
Labyrinth, 12 bytes
",)@
" (
..:
I have just discovered this language so this answer may be notably improved...
SNOBOL4 (CSNOBOL4), 69 bytes
I =INPUT
S I LEN(1) . X REM . I :F(O)
O =O X X :(S)
O OUTPUT =O
END
Prints with a single trailing newline.
Japt, 2 bytes
Oliver beat me to the straightforward, 1 byte solution.
íU
Interleaves the input with itself.
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)
Standard ML (MLton), 35 bytes
String.translate(fn c=>str c^str c)
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.
T-SQL 2008, 78 bytes
DECLARE @ varchar(max)='Double speak!'
,@z int=1WHILE @z<=len(@)SELECT
@=stuff(@,@z,0,substring(@,@z,1)),@z+=2PRINT @
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)
MarioLANG, 23 20 17 bytes
>,
"+
.[
.<
!-
#=
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.
Python 2, 31 bytes
Realised I was beaten to it already.
lambda s:''.join(c*2for c in s)
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
Gema, 5 characters
?=?$0
Sample run:
bash-5.0$ gema '?=?$0' <<< 'Double speak!'
DDoouubbllee ssppeeaakk!!
Pyth, 2 bytes
.i
.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.










