| Bytes | Lang | Time | Link |
|---|---|---|---|
| 103 | SAKO | 250319T103327Z | Acrimori |
| 024 | Janet | 250319T101640Z | xigoi |
| 037 | BrainChild | 250317T040123Z | ATaco |
| 004 | ☾ | 250315T143221Z | Joao-3 |
| 069 | Bespoke | 250216T115658Z | Josiah W |
| 087 | Plain TeX | 250304T232244Z | jlab |
| 036 | Swift 6 | 250301T220310Z | macOSist |
| 010 | AWK | 250228T144922Z | xrs |
| 011 | Zsh | 210418T062336Z | pxeger |
| 027 | TIBASIC | 230727T232507Z | joyofori |
| nan | 230603T192058Z | Dadsdy | |
| 003 | Thunno 2 | 230603T180328Z | The Thon |
| 066 | Go | 230318T071100Z | The Thon |
| 011 | Trilangle | 230315T151201Z | Bbrk24 |
| nan | 230315T125502Z | The Thon | |
| 036 | Python 3 | 221220T055151Z | U13-Forw |
| 255 | Nibbles | 221108T140026Z | Dominic |
| 082 | Pascal | 221108T144004Z | Kai Burg |
| nan | Fig | 221103T165541Z | Seggan |
| 5036 | C gcc | 221015T052051Z | Rhaixer |
| 001 | Japt m | 221103T152335Z | Shaggy |
| 028 | makina | 221103T135809Z | Ginger |
| 013 | K ngn/k | 221015T022007Z | oeuf |
| 001 | str | 221017T064834Z | Conor O& |
| 020 | Factor | 221015T053820Z | chunes |
| 002 | Vyxal | 220509T172513Z | naffetS |
| 007 | Duocentehexaquinquagesimal | 210415T184921Z | Makonede |
| 012 | Powershell | 180710T201003Z | mazzy |
| 003 | Vyxal | 200929T020231Z | lyxal |
| 006 | Check | 170530T165956Z | Esolangi |
| 003 | 05AB1E | 201117T175640Z | Makonede |
| 038 | Nim | 201117T165313Z | xigoi |
| 003 | GolfScript | 201117T152140Z | Samuel W |
| 021 | Add++ | 201117T124447Z | PkmnQ |
| 004 | Husk | 201117T082716Z | Dominic |
| 009 | Forth gforth | 201102T022032Z | Bubbler |
| 006 | Labyrinth | 200929T004705Z | Bubbler |
| 027 | Rockstar | 200923T170058Z | Shaggy |
| 042 | Flurry bnb | 200824T023751Z | Bubbler |
| 024 | Java | 200328T233236Z | Benjamin |
| 005 | Gol><> | 200328T155830Z | Gegell |
| 023 | Python 3 | 200328T132418Z | Dion |
| 012 | Ahead | 200328T094424Z | snail_ |
| 020 | Kotlin | 200328T093951Z | snail_ |
| 005 | GolfScript | 200124T003821Z | user8505 |
| 040 | naz | 200123T181527Z | sporebal |
| 084 | C# .NET | 191119T232221Z | canttalk |
| 011 | x8616 ASM | 191118T213455Z | 640KB |
| 008 | Cascade | 191116T050556Z | Unrelate |
| 003 | Keg | 191115T023812Z | lyxal |
| 009 | Runic Enchantments | 191115T194448Z | Draco18s |
| 010 | Ruby p | 191115T172646Z | histocra |
| 003 | 05AB1E | 170525T132059Z | Riley |
| 028 | BrainFlak | 191115T122915Z | Dorian |
| 081 | Poetic | 191115T115939Z | JosiahRy |
| 022 | Wren | 191115T035414Z | user8505 |
| 084 | Java JDK | 181022T094138Z | Syed Ham |
| 004 | J | 181022T044845Z | Bubbler |
| 037 | Pepe | 181011T120820Z | u-ndefin |
| 023 | Octave / Matlab | 180710T204742Z | PieCot |
| 023 | R | 180710T011345Z | JayCe |
| 012 | dc | 180710T193738Z | Sophia L |
| 037 | Yabasic | 180710T012647Z | Taylor R |
| 025 | Python 2 | 170525T131403Z | hyperneu |
| 004 | MATL | 180708T071514Z | Sundar R |
| 015 | Julia 0.6 | 180630T213052Z | Sundar R |
| 009 | Z80Golf | 180623T120133Z | lynn |
| 013 | TIBasic | 171212T131046Z | Timtech |
| 004 | Vim | 171212T124014Z | Maya |
| 007 | Perl 5 | 170525T132440Z | Dada |
| 018 | dc | 170525T143805Z | Felipe N |
| 064 | Jq 1.5 | 170919T065735Z | jq170727 |
| 009 | Ly | 170919T021233Z | LyricLy |
| 003 | RProgN 2 | 170919T022608Z | ATaco |
| 018 | dc | 170919T013027Z | cab404 |
| 005 | Befunge98 PyFunge | 170918T210759Z | MercyBea |
| 003 | Pyth | 170525T200602Z | KarlKast |
| 015 | Excel VBA | 170525T132209Z | Taylor R |
| 012 | Carrot | 170720T153001Z | user4180 |
| 032 | Common Lisp | 170720T152909Z | Renzo |
| 006 | J | 170612T234537Z | Conor O& |
| 009 | q/kdb+ | 170530T184653Z | mkst |
| 032 | TSQL | 170607T213803Z | BradC |
| 012 | Ruby | 170530T080511Z | Value In |
| 011 | Hexagony | 170525T220933Z | Riley |
| 001 | APL Dyalog 13.2 | 170607T113226Z | Adá |
| 004 | Retina | 170525T133533Z | TheLetha |
| 022 | Powershell | 170526T084613Z | Sivapras |
| 016 | shortC | 170525T222252Z | MD XF |
| 038 | Whitespace | 170525T142449Z | Rod |
| 005 | Aceto | 170530T184622Z | L3viatha |
| 011 | Bash + Coreutils | 170530T184137Z | markasof |
| 045 | C | 170525T155451Z | sigvaldm |
| 617 | Perl 5 | 170530T065555Z | Chris |
| 115 | Windows batch | 170530T060831Z | stevefes |
| 027 | Clojurescript | 170529T054720Z | madstap |
| 012 | Shell utils | 170527T201929Z | CSM |
| 019 | TXR Lisp | 170527T012929Z | Kaz |
| 002 | Chip | 170526T194651Z | Phlarx |
| 017 | Lua | 170526T184805Z | Delya Er |
| 006 | APL | 170525T133130Z | Uriel |
| 002 | V | 170525T153846Z | DJMcMayh |
| 016 | Brainfuck | 170526T123046Z | Mika Lam |
| 023 | Python | 170526T073632Z | spark |
| 032 | C | 170526T074118Z | Khaled.K |
| 024 | Java 8 | 170526T071748Z | Kevin Cr |
| nan | 170525T161246Z | Shaun Be | |
| 021 | PowerShell | 170525T135950Z | colsw |
| 018 | PowerShell | 170526T040939Z | briantis |
| 016 | Bash | 170526T024229Z | RJHunter |
| 030 | C | 170525T221542Z | MD XF |
| 006 | Cubix | 170525T221814Z | MickyT |
| 002 | Convex | 170525T221721Z | GamrCorp |
| 007 | sed | 170525T214752Z | Riley |
| 027 | REXX 27 Bytes | 170525T210707Z | theblitz |
| 131 | x64 ASSEMBLY linux nasm | 170525T203711Z | Samuel |
| 017 | pb | 170525T192603Z | undergro |
| 022 | JavaScript ES8 | 170525T191731Z | Shaggy |
| 028 | BrainFlak | 170525T191201Z | Riley |
| 007 | Haskell | 170525T125730Z | Laikoni |
| 010 | Perl 6 | 170525T165702Z | Sean |
| 031 | C | 170525T161234Z | sigvaldm |
| 023 | Rust | 170525T160828Z | TheLetha |
| 031 | C tcc | 170525T150000Z | cleblanc |
| 007 | ><> | 170525T143806Z | AGourd |
| 015 | Scala | 170525T142242Z | jaxad012 |
| 003 | APL Dyalog | 170525T141508Z | Adá |
| 019 | Python | 170525T125938Z | Gáb |
| 002 | Jelly | 170525T140040Z | Erik the |
| 019 | tcl | 170525T135332Z | sergiol |
| 025 | Lua | 170525T133247Z | Felipe N |
| 004 | CJam | 170525T133038Z | Business |
| 021 | Mathematica | 170525T132959Z | alephalp |
| 018 | Excel | 170525T132913Z | Engineer |
| 028 | PHP | 170525T132459Z | Jör |
| 004 | Gema | 170525T132252Z | manatwor |
| 005 | Retina | 170525T132203Z | Neil |
| 014 | Octave | 170525T131722Z | alephalp |
| 024 | C# | 170525T125414Z | TheLetha |
| 036 | PHP | 170525T130915Z | Mayube |
| 018 | brainfuck | 170525T130538Z | Nitrodon |
| 022 | JavaScript ES6 | 170525T125536Z | Tom |
| 030 | Mathematica | 170525T130248Z | ZaMoC |
| 022 | SmileBASIC 3 | 170525T125933Z | snail_ |
| 001 | Japt | 170525T125910Z | Tom |
| 023 | JavaScript ES6 | 170525T125755Z | Justin M |
SAKO, 103 bytes
CALKOWITE:*W,I
BLOK(9):W
CZYTAJWIERSZ:W
*)GDYW(I)=58:1,INACZEJ2
2)POWTORZ:I=0(1)9
1)LINIII
STOP1
KONIEC
Doesn't really work on strings longer than 9 characters, for that it would need more bytes.
Janet, 24 bytes
|(peg/replace-all 1" "$)
Bespoke, 84 69 bytes
-15 bytes by taking ch to the power of itself, which errors out upon EOF. (Nice.)
nothing visible there
is it good?possibly
not bad if spy is seeing it
Prints a space (ASCII 32) for each inputted character.
Plain TeX, 87 bytes
\def\p#1{\phantom{#1}\egroup}{\obeylines\gdef~{\bgroup\obeylines\obeyspaces\def
{ }\p}}
(including the carriage return).
Explanations
The typesetting program TeX has a command \phantom to generate invisible contents. We can then simply define a command with
\def~#1{\phantom{#1}}
which corresponds to 21 bytes.
The problem is that TeX aggregate successive spaces (SPC) and ignore carriage return (CR) in command arguments. To change that, we can add
\obeylines
\obeyspaces
\def^^M{ }
where ^^M gives the ASCII code of the carriage return (CR).
This works, but alters the meaning of SPC and CR in all the rest of the document. Avoiding that is a bit more tricky and needs and auxiliary macro
{% open a group
\obeylines% make carriage return char an 'active' character
\gdef~{% define ~ globally
\bgroup% open a group
\obeylines% in this group, make SPC
\obeyspaces% and CR be active and act normally
\def
{ }% define the CR to be a space (no % at end of the previous line)
\p% call \p
}% end of ~ definition
}% close the current group: SPC and CR retrieve their standard definitions
\def\p#1{%
\phantom{#1}% generate invisible content
\egroup% close the current group
}
Test code
\def\p#1{\phantom{#1}\egroup}{\obeylines\gdef~{\bgroup\obeylines\obeyspaces\def
{ }\p}}
\tt
\frenchspacing
>1234567890123< 13 spaces\par
>~{Hello, World!}<
\vskip 1em
>12< 2 spaces\par
>~{Hi}<
\vskip 1em
>123456789012345678901234567890123456789012345< 45 spaces\par
>~{ Don't
Forget about
Existing
Whitespace! }<
\vskip 1em
>< 0 space\par
>~{}<
\vskip 1em
>1234567890123< 13 spaces\par
>~{ }<
\vskip 1em
>1< 1 space\par
>~{
}<
\bye
Note we need \tt to get a monospaced font (typewriter for TeX) and \frenchspacing to get spaces after punctuation marks (such as the !) have the same width (TeX is designed to typeset documents, not for code golfing).
Swift 6, 36 bytes
{{String.init}()(" ",($0+"").count)}
To use this, assign it to something and then call that thing:
let whitespace = {{String.init}()(" ",($0+"").count)}
print(whitespace("Hello, world!"), terminator: "")
// Prints " "
The {String.init}() trickery simply gives us a reference to String.init(repeating:count:), but without the costly argument labels. Appending an empty string to $0 (the implicit closure parameter) informs the type checker that $0 is a String.
TI-BASIC, 27 bytes
Input Str1
For(X,1,length(Str1
Disp "
End
I love TI-84 because it completes my parentheses and quotes for me.
At the same time, it is quite annoying indeed how there is no string repeat (as far as I know). Even more annoying is that (as far as I know) all input is int not str and any text passed will result in a single newline. I hope this is still valid despite that. That was my bad. I was using an int variable.
Bytecount on TI-BASIC is kind of complex, the best way that I know of is going to TI Connect [CE] and looking for your program there.
Explained:
Input Str1 Ask for input and store in string variable
length(Str1 Length of Str1
For(X,1,... Loop through following code that many times
Disp " Display a blank string (with newline)
End End loop, go back to the For.
Test cases:
Typing on a TI-84 Plus CE is hard.
In these examples "-" is displayed instead of newline so you don't have to count.


(,) 40 34 Chars or \$34\log_{256}(3)\approx6.74\$ Bytes
(,,,()()()()()()()()()(),((()())))
Or, printing spaces (54 Chars or 10.7 Bytes):
((),()()()()()()()())(,,,(())(())(())(()),((()())),())
Thunno 2, 3 bytes
l⁻ṣ
Explanation
l⁻ṣ # Implicit input
l # Length
⁻ # Decrement
ṣ # Spaces
# Implicit output with newline
Go, 66 bytes
import."strings"
func f(s string)string{return Repeat(" ",len(s))}
As far as I'm aware, you can't multiply strings and numbers to repeat a string in Go - you have to use strings.Repeat.
Trilangle, 11 bytes
i7#'@"o.:2L
Unfolds to this:
i
7 #
' @ "
o . : 2
L . . . .
This has to be the most creative way I've used @ yet: when hit in one direction, it ends the program; when hit in a different direction, it's divided by 2 to get a space.
Roughly equivalent to this C code:
#include <stdio.h>
int main() {
while (getchar() != EOF) {
printf(" ");
}
}
Thunno, \$ 6 \log_{256}(96) \approx \$ 4.94 bytes
L1-A_*
Note: A\ will also work instead of A_ if you want newlines rather than spaces.
Explanation
L1-A_* # Implicit input
L # Length
1- # Minus one
* # Multiplied by
A_ # A space
# Implicit print
# with a newline
Nibbles, 2.5 bytes (5 nibbles)
.$' '
A function that returns a string of spaces the same length as its argument.
(This won't work as a full program, since Nibbles will write a newline at the end of its output).
. # map over
$ # characters of the argument
' ' # returning a space for each
Obviously the output is invisible, but we can call this function from within a program that wraps the output into quotes to see the output string:
;~ # save this function:
.$' ' # <convert to invisible text>
:'"'$ # prepend saved function results with a quote
: '"' # and append that with another quote
Nibbles, 3.5 bytes (7 nibbles)
>>.$' '
Full program. We can't stop Nibbles from writing the trailing newline at the end of its output, so we shorten the invisible string by one character.
. # map over
$ # characters of the argument
' ' # returning a space for each
>> # and then remove the first character
Pascal, 82 B
This program merely requires a processor complying to ISO standard 7185 “Pascal”.
Since it is not guaranteed that writeLn produces exactly one character (on some platforms the line separator is CR+LF), we’ll have to use write(' '):
program p(input,output);begin while not EOF do begin write(' ');get(input)end end.
If input was simply a string value, when an ISO standard 10206 “Extended Pascal” processor is used the following is the shortest solution (≥ 24 B):
writeStr(outputStringVariable, '':length(inputMyString))
The :someNonNegativeIntegerValue after the empty string '' will (left) pad the given argument to the specified width using space characters (' ').
A complete demonstration:
program paddingDemo(output); begin write('':length('Hello, World!')) end.
Fig, \$4\log_{256}(96)\approx\$ 3.292 bytes
;M/
Note the space at the end.
;M/<space>
;M # Replace all in the input
/<space> # With a space
; # Print without newline
C (gcc), 50 36 bytes
Totally pays off that printf doesn't automatically print a newline.
36 bytes by ceilingcat
f(char*n){for(;printf(" "+!*n++););}
Japt -m, 1 byte
S
S :Implicit map of each character in input string
S :Literal space
Less Trivial (w/o flag), 3 bytes
r.S
r.S :Implicit input of string
r :Replace
. :RegEx /./g
S :With space
Even Less Trivial, 6 bytes
©SißUÅ
©SißUÅ :Implicit input of string U
© :Logical AND with
Si :Space prepended with
ß : Recursive call with argument
UÅ : U with first character removed
makina, 28 bytes
v>>>n0;
>wPH
vO*OL
ti ^C
> ;
Uses a few clever tricks, like using the space literal to stop the input instruction. Sadly, it's pretty difficult to explain makina, but you can look at the esolangs.org page if you want to figure out how this program works.
K (ngn/k), 14 13 bytes
{x,(1+#x)#""}
-1 byte thanks to ngn!
Dead simple.
Explanations:
{x,(1+#x)#""} Main function. Takes x as input
x, x concat with
"" An empty string (Implicit whitespace)
# Duplicate with the amount of
( #x) Length of x
1+ + 1 times
str, 1 byte
s
Since str manipulates streams byte-by-byte, this outputs 1 space for each input character.
Factor, 20 bytes
[ [ drop bl ] each ]
For each character in the input string, drop it from the data stack and output a space.
Vyxal, 2 bytes
LI
Vyxal S, 2 bytes
v¤
If we want to port the Jelly answer, then:
Vyxal rs, 3 bytes
fð•
Powershell, 18 12 bytes
-6 bytes thanks @Julian
$args|%{' '}
Testscript (use LF only mode in your editor):
$f = {
$args|% t*y|%{' '}
}
@(
,(13, "Hello, World!")
,(2, "Hi")
,(45, " Don't
Forget about
Existing
Whitespace! ")
,(0, "")
,(13, " ")
,(1,"
")
) | % {
$len,$source=$_
$r = &$f $source
$l=$r.length
"$($l-eq$len): $l"
}
Output:
True: 13
True: 2
True: 45
True: 0
True: 13
True: 1
Powershell + Regex, 20 bytes
$args-replace'.',' '
Vyxal, 3 bytes
Lð*
Command-line usage:
python3 Vyxal.py file_name "" input_string
Explained
L # Push the length of the implicit input
ð # Push a space character
* # Multiply that space by the length and output.
Check, 6 bytes
," "*o
Pass the input by the command-line arguments as a list of code points, i.e. [72,101,108,108,111,44,32,87,111,114,108,100,33].
Explanation:
,gets the length of the input." "pushes an array containing32(for space).*repeats that array as many times as the length of the input.odisplays the result as a list of characters.
05AB1E, 3 bytes
gð×
gð× # full program
ð # a space...
× # repeated...
g # length of input...
× # times
Nim, 38 bytes
for _ in stdin.readAll:stdout.write" "
Since Nim is style-insensitive, something like this also works:
fOr _ iN sTdIn.rEaDaLl:sTdOuT.wRiTe" "
GolfScript, 3 bytes
,n*
pretty self explanatory, and I don't think there is a way to make it smaller unless there is some really weird thing with % or /.
Husk, 4 bytes
R' L
Try it online! (Note: prints xs instead of spaces so that the output is visible; change the x to to [not] see the real version)
Forth (gforth), 9 bytes
typewhite
It is a gforth built-in. A string in gforth is commonly represented as addr length, and typewhite consumes addr length and prints length spaces.
Labyrinth, 6 bytes
,
\"@
A character input command, a newline-printing command, a halt command, and a three-way junction for branching. I don't think we can do better than that. (A conditional halt without a three-way junction should involve division by zero, which gets unnecessarily verbose)
Start at the first valid command
, Take a character input (-1 on EOF)
" A no-op at 3-way junction: turn left if negative, turn right if positive
(we can assume the input string consists of printable ASCII, which is > 0)
\ If positive: print a newline, turn backwards
" 3-way junction: top > 0, so turn right (which is reflected to left by a wall)
, Repeat from the start of the program until it hits EOF
@ If EOF, halt
Rockstar, 27 bytes
listen to S
cut S
say " "*S
Try it here (Code will need to be pasted in)
Replace the last line with the below to wrap the output in single quotes.
say "'"+" "*S+"'"
Flurry -bnb, 42 bytes
[]{(){}{}}[]{({})}<((({<({}){}>})){}){}{}>
Run example (using Haskell interpreter)
$ printf "Hello World!" | ./flurry -bnb a.flr
$ printf "Hello World!" | ./flurry -bnb a.flr | wc -c
12
It takes 24 bytes just to construct a single space (32): <((({<({}){}>})){}){}{}>. Even worse is that it takes 2 more byets to construct a single newline (10): (<><<>()>)<(<({}){}>{}){}>...
The algorithm is: empty the stack, preserving the value of stack height, and then push space that many times.
main = height pop-I height push-I 32
// Return self, popping and discarding one item from stack
pop-I = \x. K x pop
// (height pop-I height) returns original stack height with
// the stack emptied as a side effect
// Return self, pushing itself to the stack once
push-I = \x. push x
32 = 2**2 * 2**2 * 2
= <(2 2)(2 2)2>
= <(push ((push (push 2)) pop)) pop pop>
Gol><>, 5 bytes
iEH~a
Explanation
i Push 1 char from the input to the stack
E If EOF was reached execute next, else skip 1
H Output the entire stack as chars and halt
~a Discard the last read char and push 0x0a to the stack
Since Gol><> is actually a 2D language the programm counter loops back to the other side when it hits a border. This is used to loop back to the beginning after the discard & 0x0a push step.
Kotlin, 20 bytes
{" ".repeat(length)}
{" ".repeat // repeat space
(length)} // length of input
naz, 40 bytes
2a2x1v1x1f1r3x1v2e0m4a8m1o1f0x1x2f0a0x1f
Works for any input string terminated with the control character STX (U+0002).
Explanation (with 0x commands removed)
2a2x1v # Set variable 1 equal to 2
1x1f1r3x1v2e # Function 1
# Read a byte of input
# Jump to function 2 if it equals variable 1
0m4a8m1o1f # Otherwise, output a space and jump back to the start of function 1
1x2f0a # Function 2
# Add 0 to the register
1f # Call function 1
C# .NET, 84 bytes
class P{static void Main(string[]a){System.Console.Write("".PadLeft(a[0].Length));}}
x86-16 ASM, IBM PC DOS, 11 bytes
Binary:
00000000: 8a0e 8000 49b8 200a cd10 c3 ....I. ....
Unassembled:
D1 EE SHR SI, 1 ; SI to 80H (SI intialized at 100H)
AC LODSB ; load string length into AL
91 XCHG AX, CX ; put input string length into CX
49 DEC CX ; remove leading whitespace from length
AC LODSB ; load whitespace delimiter into AL
B4 0A MOV AH, 0AH ; BIOS "write character CX number of times" function
CD 10 INT 10H ; call BIOS, display to console
C3 RET ; return to DOS
Explanation:
Input is via command line, though all that's important is the length. Command line input length is always stored at memory address DS:0080H in DOS, so put that into CX. DOS includes the space between the executable name and the command line args string in this number.
For example: in FOO.COM Hello, length is 6 and command line string is " Hello", or calling as FOO.COM/Hello, command line string is "/Hello" (Note: those are the the only valid characters for the character immediately after the executable name). This first character (will be a space when called normally) is what is displayed as the "invisible text" for output. This builds in a handy little "debug mode" where you can use a slash instead of a space to actually be able to test your output is the right length.
Then, use the IBM PC BIOS's INT 10H "Write character only at cursor position" (0AH) function that writes the same character CX number of times.
Example Output:
Admittedly, displaying 13 chars of whitespace is not very interesting in a screenshot. However, by using a slash instead of a space ("debug mode") you can actually see that you are displaying the right number of chars.
Cascade, 14 11 9 8 bytes
? .'
,^\
-1 byte thanks to Jo King realizing it's shorter to just turn into two lines
Since the program never uses the return values of anything other than , and ', and the order spaces are printed in doesn't matter (since they're indistinguishable), ^ can be used backwards: instead of printing a space then recurring, this recurs then prints a space.
Ungolfed, this looks something like:
@
?
|\
, \
^
/ \
/ .
| \
| '
|
If tabs are legal whitespace alongside spaces and newlines:
Cascade, 7 bytes
? .
,^9
thanks to Jo King.
Keg,-lp -ir, 3 bytes
( ,
This takes input as characters and prints a space for each character
The -lp flag makes the length() function take input if the stack is empty and the -ir flag ensures that the implicit input is as characters.
Runic Enchantments, 9 bytes
" "il͍*@
Note that spaces and newlines need to be escaped in the input, as input is automatically split otherwise.
Ruby -p, 10 bytes
$_=$/*~/$/
Explanation:
$_= Output equals
$/ the output separator (defaults to newline)
* repeated a number of times equal to
~ the index in the input of the first match of
/$/ the regular expression for "end of line"
05AB1E, 3 bytes
vð?
v # For each character...
ð? # Output a space without a newline
Other 3 byte solutions (Thanks Magic Octopus Urn and Kevin Cruijssen for most of these)
v¶? # For each character print a newline (without adding a newline)
võ, # For each character print the empty string with a newline
gð× # Get the length, concatenate that many copies of space
g¶× # Get the length, concatenate that many copies of newline
Sð: # Split, push a space, replace each char in input with a space
ðs∍ # Push ' ', swap, make the string of spaces as long as the input was
võJ # For each char, push a space and ''.join(stack)
v¶J # For each char, push a newline and ''.join(stack)
€ðJ # For each char, push a space. Then ''.join(stack)
€¶J # For each char, push a newline. Then ''.join(stack)
Brain-Flak, 28 bytes
{}{{}<>((()()()()()){})<>}<>
{} pop one input character (because Brain-Flak always outputs a trailing newline
{ for each input character
{} pop that character
<> switch to other stack
((()()()()()){}) push 10 (newline)
<> back to input stack
}
<> switch to other stack. This is printed implicitly when the program ends
Poetic, 81 bytes
the berenstein bears
i remember a series i spelled wrong
o m gee,i do remember it
The misspelling is intentional. (...or is it?)
Java (JDK), 84 bytes
static String m(String n){int i=0;String d="";while(i++<n.length())d+=" ";return d;}
J, 4 bytes
LF"0
Converts each cell (each character in this case) to the linefeed character. LF is a built-in noun for '\n'. "0 attached to a noun converts it to a verb with the given rank.
Pepe, 46 37 bytes
REEeRREeeeREEEEErEeeEeeeeerEEeeeEreee
Explanation:
REEe # Input (string) in R
RREeee # Push reverse pointer position, or length of input - 1
# R flag: push in beginning
REEEEE # ...add 1
rEeeEeeeee # Push space in r
rEEeeeE # ...R times
reee # Output whole stack
dc, 12 bytes
Z256r^25.5/P
Takes input from the stack, outputs newlines to stdin.
I know there's two dc answers here already, but this one uses a different approach, with math! Plus it's 6 bytes shorter, so I guess that's all right.
Explanation
One of dc's three explicit printing commands is P, which takes a number and outputs it as a base 256 (technically base UCHAR_MAX+1, works on my machine) byte stream. So I need to feed it the number (where n is the length of the given string, and 10 is the codepoint of the linefeed character):
10*256^(n-1) + 10*256^(n-2) + ... + 10
= 10 * (256^(n-1) + 256^(n-2) + ... + 1) (factoring out 10)
= 10 * (256^n - 1) / (256 - 1) (geometric series formula)
= (256^n - 1) / 25.5 (combining constants)
~= (256^n) / 25.5 (because dc's default precision is 0)
The code is a straightforward calculation of this number, followed by P.
Yabasic, 37 bytes
Takes input, and outputs as many new lines as the length of the input
Line Input""s$
For i=1TO Len(s$)?Next
Python 2, 25 bytes
exec'print;'*len(input())
-2 bytes thanks to Loovjo
-2 bytes in the invalid code thanks to totallyhuman :p
-3 bytes
MATL, 3 4 bytes
nqZ"
Today I learnt that MATLAB has a function for creating a string of spaces!
n - count the number of bytes in input string
q - decrement by 1, because the implicit disp at the end adds a newline (so the number of spaces required is string length - 1)
Z" - blanks command: create a string with the specified number of spaces in it
(Implicit output at end, with trailing newline.)
Julia 0.6, 15 bytes
s->" "^endof(s)
^ applied to strings is the repetition operator, and endof gives the last index of the string, which is equal to the length of the string (since Julia indexing is 1-based).
Z80Golf, 9 bytes
00000000: d5cd 0380 3001 763e 20 ....0.v>
Disassembly:
push de ; push $0000
call $8003 ; getchar(A)
jr nc, k ; jump if not EOF
halt
k:ld a, ' ' ; replace A with space
; memory from $000a through $7fff is $00=NOP...
; PC reaches $8000=putchar(A) and RETs to pushed address.
(If you remove the last two bytes, this is a cat program.)
TI-Basic, 13 bytes
For(I,2,length(Ans
Disp "
End
Loop starts at 2 because an additional newline is printed before Done at the end of the program.
Vim, 4 bytes
VGr
(a trailing space)
Perl 5, 7 bytes
-1 byte thanks to @Xcali
6 bytes of code + -p flag.
y// /c
Quite straight forward : replaces every character with a space.
dc, 25 18 bytes
-1 byte thanks to brhfl
Z[1-d0<L32P]sLd0<L
Explanation:
Z[1-d0<L32P]sLd0<L
Implicit input
Z Get length
[ ]sL Create a funcion and saves in L
d0<L If length > 0, call L
1- Subtract 1 from the length
d0<L If length > 0, call L
32P Print space
Jq 1.5, 69 68 66 64 bytes
def L:length;$x|if L<1then empty elif L<2then""else L-1|.*" "end
This is longer then usual to compensate for newline jq normally emits and the odd behavior of * with N<2
Sample runs:
$ jq -Mrn --arg x 'Hello, World!' 'def L:length;$x|if L<1then empty elif L<2then""else L-1|.*" "end'
$ jq -Mrn --arg x 'Hello, World!' 'def L:length;$x|if L<1then empty elif L<2then""else L-1|.*" "end' | wc -c
13
$ echo -n 'def L:length;$x|if L<1then empty elif L<2then""else L-1|.*" "end' | wc -c
64
Shout out to Jonathan Frech for finding 3 superfluous spaces!
Ly, 9 bytes
iy[' o,];
Explanation:
iy[' o,];
iy # push length of input
[ ] # while loop
' o # output a space
, # decrement input length
; # terminate (avoids implicit output)
RProgN 2, 3 bytes
L•*
Uncreative solution is uncreative.
Just gets the length of the input, and multiplies •, which is predefined to be a space, by it.
Befunge-98 (PyFunge), 5 bytes
#@~a,
For every character in the input (#@~), this prints a new line (a,).
Pyth, 3 bytes
*dl
Python equivalent: len(input())*" "
jmk
Python equivalent: "\n".join(map("", input()))
smb
Python equivalent: "".join(map("\n",input())
VQk
Python equivalent: For N in input():print("")
Excel VBA, 17 15 Bytes
Anonymous VBE immediate window funtion that takes input from cell [A1] and outputs spaces of length of the input to the VBE immediate window
?Spc([Len(A1)])
Carrot, 12 bytes
#^//()/gS" "
Try it online! (append a ^@^v@ after the code to see the spaces bounded between @s)
Explanation
#^ Set the stack-string to be equal to the input
/ Get matches of this regex
/()/g any position (not character) in the string (shorter than /\b|\B/ by 3 bytes)
If the length of the string is 3, this returns a 4-element array
consisting of empty strings
S" " Join on spaces, so the example 4-element array will result in 3 spaces
The space can even be replaced with a literal newline or tab for the same bytecount.
q/kdb+, 14 9 bytes
Solution:
{" "}each
Example:
q){" "}each"Hello, World"
" "
Explanation:
Returns " " for each character of the input.
Notes:
I've made a shorter version (7 bytes) that does something similar:
{y}'" "
... but you have to prepend the input rather than append:
q)"hello world"{y}'" "
" "
T-SQL, 32 bytes
SELECT SPACE(LEN(a+'x')-1)FROM t
Microsoft SQL's LEN function ignores trailing spaces, so this hacky workaround is required.
Input is stored in varchar column a in pre-existing table t, per our input rules.
Hexagony, 12 11 bytes
-1 byte thanks to Martin Ender
,<.;.M@.>~8
Here is the expanded hex:
, < .
; . M @
. > ~ 8 .
. . . .
. . .
While there is input, this code runs:
, # Get input
< # Turn right (SE) if we didn't get EOF
M8 # Set the memory edge to 778 which is 10 (mod 256)
; # Print as a character (newline)
> # Redirect East
~ # Multiply by -1. This makes the pointer go to the top when it runs off the edge
8 # Effectively a no-op.
When EOF is reached:
, # Get input
< # Turn left (NE)
8 # Effectively a no-op
@ # End program
APL (Dyalog) 13.2, 1 byte
Prints only spaces.
∊ prototype (numbers become zeros, characters become spaces)
Retina, 3 4 bytes
S\`.
Old version, doesn't work because Retina prints a trailing line feed.
.  
(The second line contains a space).
Powershell, 22 Bytes
' '*(Read-Host).length
shortC, 16 bytes
f(C*a){W*a++)P'
Note the trailing space at end of code.
Conversions in this program:
C->charW->while(P->putchar(
The resulting program looks like this:
f(char *a){while(*a++)putchar(' ');}
How that works:
while(*a++)loops until it reaches the last index of the stringa.putchar(' ');prints a space for each index ofa.
Whitespace, 311 150 77 68 65 46 41 38 bytes
-3 bytes thanks to Kevin Cruijssen
-27 bytes thanks to Ephphatha
  
       
 
  
 
 
  
  
 
A visible format
'\n \n \t \t \n \n \n \t\n\t \t\t\t\n\t \n\t\n \n \n\n'
Explanation (s = space, t = tab, n = new line)
nssn # label(NULL) - loop start
ssststsn # push 10 in the stack -> [10]
sns # duplicate the top of the stack -> [10, 10]
sns # duplicate the top of the stack -> [10, 10, 10]
tnts # read a single char from input, pop the stack and store at that address -> [10, 10] [10:<char that was read>]
ttt # pop the stack and put the value at that adress on stack -> [10,<char>] [10:<char>]
ntssn # jump to label(0) - since label(0) is not defined, the interpreter jumps to the end of the program - if the top of the stack (char) is 0 -> [10] [10:<char>]
tnss # pop the top of the stack and print as ascii -> [] [10:<char>]
nsnn # go back to the label(NULL)
Aceto, 5 bytes
Trivial in Aceto:
p
,'O
Reads a character, pushes a space, prints it, and goes back to the start.
Bash + Coreutils, 11 Bytes
tr -c \ \
C, 45 bytes
Using main. Compile with gcc, ignore warnings.
main(c,v)char**v;{while(*(v[1]++))puts("");}
Usage:
$./a.out "Hello, World!"
Perl 5, 6 + 1 = 7 bytes
Uses the -p flag.
y// /c
y/// is the transliteration operator: the first list is translated to the corresponding character in the second list. Without the c, this does nothing, but the c complements the first list, so all characters are transliterated to a space.
Windows batch, 115 bytes
@set i=%~1
@set p=0
@set/ac=-1
:N
@call set t=%%i:~%p%,1%%
@set/ac+=1
@set/ap+=1
@if "%t%" NEQ "" @goto N
@echo %c%
Re-used code from my answer in Is the checkbox not not unchecked?
Clojurescript, 27 bytes
#(apply str(map(fn[]" ")%))
Because it's based on js, clojurescript doesn't care about arity errors. That saves one byte over the clojure eqivalent.
Shell utils, 14 12 bytes
tr ' -~' ' '
tr translates characters in the first parameter, into the corresponding one in the second parameter. (space)-~ is a range for space (32) to tilda (126), the first and last printable ASCII characters. They are mapped into a space; tr duplicates the last character in the output list if it is shorter than the input list.
TXR Lisp, 22 19 bytes:
(op regsub #/./" ")
Previously:
(op mapcar(ret[" "0]))
That is a function to which we can pass a string:
REPL:
1> (op regsub #/./" ")
#<interpreted fun: lambda #:rest-0164>
2> [*1 "abc"]
" "
" "
Chip, 2 bytes
*f
Chip reads in a byte, does whatever calculations are in the code, and writes a byte. So, for each byte of input, we ignore the input and write 0x20 instead. The empty Chip program would replace each byte of input with a null byte of output.
* Source element, activates any neighbor elements
f Output element for the bit 0x20, when active this bit is set in the output
Transposing the two characters would result in the same thing. I opted to use spaces, since 0x20 requires only one bit to be set. 0x0a requires setting two bits. Code for that could be:
b*d
Lua, 17 Bytes
s=s:gsub("."," ")
Simple regular expression substitution, replaces any character found with a space.
APL, 11 6 bytes
5 bytes saved thanks to @Adám
' '⍴⍨≢
Uses the Dyalog Classical character set.
Brainfuck, 16 bytes
Prints newlines.
,[>++++++++++.,]
Python, 23 bytes
print(''*len(input()))
First time
C, 32 bytes
Try Online modifying characters into spaces
f(char*t){(*t=*t?32:0)&&f(t+1);}
C, 37 bytes
Try Online Left-padding the end-of-string with its length
f(char*t){printf("%*c",strlen(t),0);}
Java 8, 24 bytes
s->s.replaceAll("."," ")
Java 7, 49 bytes
String c(String s){return s.replaceAll("."," ");}
ZX80 (4K ROM version with sanity check)
~58 bytes (listing)
1 INPUT A$
2 IF A$="" THEN GO TO 1
3 PRINT " ";
4 LET A$=TL$(A$)
5 IF A$="" THEN STOP
6 GO TO 3
Line 2 can be removed to save RAMs. However, if an empty string is entered without line 2 then it will PRINT one space.
Bash, 16 bytes
printf %*s ${#1}
Uses parameter expansion count the length of the argument ${#1}, and then printf to output an empty string space-padded to that same length.
Cubix, 6 bytes
Wahoo a 6 byter!
wi?@oS
Cubified
w
i ? @ o
S
igets input?test top of stack- if negative (EOI) redirect onto
wlane change which umps to the@halt - if 0 (null) halt this shouldn't be hit
- if positive
Sowpush space to the stack, output and change lane ontoi
- if negative (EOI) redirect onto
Convex, 2 bytes
,*
Simply takes the length of the input and multiplies by newlines (which are at the bottom of the stack)
REXX 27 Bytes
say left("",length(arg(1)))
x64 ASSEMBLY (linux nasm) - 131 bytes
mov r8, [rsp+16]
mov rdi, 1
mov rdx, 1
mov rax, 1
mov rsi,n
l:syscall
inc r8
cmp byte [r8],0x00
jnz l
mov rax,60
syscall
n: db " "
build and run with:
nasm -felf64 invisible_golfed.asm
ld invisible_golfed.asm
./a.out
This will give the warning
ld: warning: cannot find entry symbol _start; defaulting to 00000000000400080
warning free version below
without warnings - 152
global _start
_start:mov r8, [rsp+16]
mov rdi, 1
mov rdx, 1
mov rax, 1
mov rsi,n
l:syscall
inc r8
cmp byte [r8],0x00
jnz l
mov rax,60
syscall
n: db " "
pb - 17 bytes
^w[B!0]{>}<vb[32]
Goes to the last character of the input and puts a space on the canvas cell representing it. Because output in pb is 2D, the empty cells before it are automatically filled in with spaces when it's outputted.
JavaScript (ES8), 22 bytes
s=>"".padEnd(s.length)
Brain-Flak, 28 bytes
{{}<>((()()()()()){})<>}<>{}
{{} } # For every input character...
((()()()()()){}) # Push 10...
<> <> # on the other stack
<> # Switch to the stack with all of the newlines
{} # Pop a newline because the interpreter prints a newline :(
Haskell, 7 bytes
(>>" ")
Try it online! Usage: (>>" ") "Hello, world!".
Given two lists (and strings are lists of characters in Haskell) the >> operator will repeat the second list as many times as the first list has elements. Setting " " as second argument means we concatenate as many spaces as the input string is long.
Alternative (same byte count):
(' '<$)
Try it online! Usage: (' '<$) "Hello, world!".
Given some value and a list, the <$ operator replaces each value in the list with the given value. Thus 5 <$ "abc" results in [5,5,5], and ' ' <$ "abc" in " ".
The function can equivalently be written as (<$)' ', in case you want to find some more marine creatures in my code.
C, 31 bytes
f(char*c){puts(""),*c++&&f(c);}
Rust, 23 bytes
|s|" ".repeat(s.len());
First time using Rust so not 100% sure I've got everything correct, let me know if I need to change anything. I couldn't work out how to test this, as I'm still new to it, but judging from the documentation it should work. Also any improvements are more than welcome!
><>, 7 bytes
i0(?;ao
The program is a loop
i //Push a character from the input onto the stack
0 //Add a 0 to the stack
( //Pop the top two values of the stack, and push a 1 if the second is less than the first (In this case, the input has all been read), else push a 0
? //Pop the top of the stack. If the value is a 0, skip the next instruction
; // Terminate the program
a // Add a newline to the stack
o // Pop the top character of the stack and print it
Scala, 15 bytes
s=>" "*s.length
APL (Dyalog), 3 bytes
Prints only newlines.
0/⍪
⍪ table (makes string into column matrix)
0/ replicate each column zero times
Python, 19 bytes
lambda s:' '*len(s)
tcl, 19
regsub -all . $s \
To test it, click "Run it" button and then select the white space on the white bottom area. A better test is to add a space and a letter before the ] as I describe:
puts [regsub -all . $s \ x]
^^ Two spaces here
and it will output the count of characters of each string exactly equal to the ones on the question.
Mathematica, 21 bytes
StringReplace[_->" "]
PHP, 28 Bytes
for(;a&$argn[$i++];)echo" ";
PHP, 29 Bytes
<?=str_pad('',strlen($argn));
Gema, 4 characters
?=\
(There is a space at the end of code.)
Sample run:
bash-4.4$ echo -n 'Hello, World!' | gema '?=\ '
bash-4.4$ echo -n 'Hello, World!' | gema '?=\ ' | wc
0 0 13
Retina, 5 bytes
\`.
¶
Try it online! Changes everything into newlines. The \` suppresses the extra newline Retina would normally output.
Octave, 14 bytes
@(a)["" 0*a+32]
C#, 28 24 bytes
s=>"".PadLeft(s.Length);
Old version using the string constructor for 28 bytes:
s=>new string(' ',s.Length);
PHP, 36 bytes
<?=str_repeat('
',strlen($argv[1]));
Outputs newlines because spaces are too mainstream
brainfuck, 18 bytes
++++++++++>,[<.>,]
Prints one newline for each byte of input. Printing spaces instead would add 4 bytes.
JavaScript ES6, 22 bytes
a=>a.replace(/./g," ")
f=a=>a.replace(/./g," ");
var test = f("Hello, World!");
console.log(test, test.length);
Mathematica, 30 bytes
Row@Table[" ",StringLength@#]&
SmileBASIC 3, 22 bytes
Asks for a string from the console as input, then prints length spaces. PRINT (or ? here) adds a trailing newline by default, so we use the ; to disable it.
LINPUT A$?" "*LEN(A$);
JavaScript (ES6), 23 bytes
s=>" ".repeat(s.length)




