g | x | w | all
Bytes Lang Time Link
103SAKO250319T103327ZAcrimori
024Janet250319T101640Zxigoi
037BrainChild250317T040123ZATaco
004250315T143221ZJoao-3
069Bespoke250216T115658ZJosiah W
087Plain TeX250304T232244Zjlab
036Swift 6250301T220310ZmacOSist
010AWK250228T144922Zxrs
011Zsh210418T062336Zpxeger
027TIBASIC230727T232507Zjoyofori
nan230603T192058ZDadsdy
003Thunno 2230603T180328ZThe Thon
066Go230318T071100ZThe Thon
011Trilangle230315T151201ZBbrk24
nan230315T125502ZThe Thon
036Python 3221220T055151ZU13-Forw
255Nibbles221108T140026ZDominic
082Pascal221108T144004ZKai Burg
nanFig221103T165541ZSeggan
5036C gcc221015T052051ZRhaixer
001Japt m221103T152335ZShaggy
028makina221103T135809ZGinger
013K ngn/k221015T022007Zoeuf
001str221017T064834ZConor O&
020Factor221015T053820Zchunes
002Vyxal220509T172513ZnaffetS
007Duocentehexaquinquagesimal210415T184921ZMakonede
012Powershell180710T201003Zmazzy
003Vyxal200929T020231Zlyxal
006Check170530T165956ZEsolangi
00305AB1E201117T175640ZMakonede
038Nim201117T165313Zxigoi
003GolfScript201117T152140ZSamuel W
021Add++201117T124447ZPkmnQ
004Husk201117T082716ZDominic
009Forth gforth201102T022032ZBubbler
006Labyrinth200929T004705ZBubbler
027Rockstar200923T170058ZShaggy
042Flurry bnb200824T023751ZBubbler
024Java200328T233236ZBenjamin
005Gol><>200328T155830ZGegell
023Python 3200328T132418ZDion
012Ahead200328T094424Zsnail_
020Kotlin200328T093951Zsnail_
005GolfScript200124T003821Zuser8505
040naz200123T181527Zsporebal
084C# .NET191119T232221Zcanttalk
011x8616 ASM191118T213455Z640KB
008Cascade191116T050556ZUnrelate
003Keg191115T023812Zlyxal
009Runic Enchantments191115T194448ZDraco18s
010Ruby p191115T172646Zhistocra
00305AB1E170525T132059ZRiley
028BrainFlak191115T122915ZDorian
081Poetic191115T115939ZJosiahRy
022Wren191115T035414Zuser8505
084Java JDK181022T094138ZSyed Ham
004J181022T044845ZBubbler
037Pepe181011T120820Zu-ndefin
023Octave / Matlab180710T204742ZPieCot
023R180710T011345ZJayCe
012dc180710T193738ZSophia L
037Yabasic180710T012647ZTaylor R
025Python 2170525T131403Zhyperneu
004MATL180708T071514ZSundar R
015Julia 0.6180630T213052ZSundar R
009Z80Golf180623T120133Zlynn
013TIBasic171212T131046ZTimtech
004Vim171212T124014ZMaya
007Perl 5170525T132440ZDada
018dc170525T143805ZFelipe N
064Jq 1.5170919T065735Zjq170727
009Ly170919T021233ZLyricLy
003RProgN 2170919T022608ZATaco
018dc170919T013027Zcab404
005Befunge98 PyFunge170918T210759ZMercyBea
003Pyth170525T200602ZKarlKast
015Excel VBA170525T132209ZTaylor R
012Carrot170720T153001Zuser4180
032Common Lisp170720T152909ZRenzo
006J170612T234537ZConor O&
009q/kdb+170530T184653Zmkst
032TSQL170607T213803ZBradC
012Ruby170530T080511ZValue In
011Hexagony170525T220933ZRiley
001APL Dyalog 13.2170607T113226ZAdá
004Retina170525T133533ZTheLetha
022Powershell170526T084613ZSivapras
016shortC170525T222252ZMD XF
038Whitespace170525T142449ZRod
005Aceto170530T184622ZL3viatha
011Bash + Coreutils170530T184137Zmarkasof
045C170525T155451Zsigvaldm
617Perl 5170530T065555ZChris
115Windows batch170530T060831Zstevefes
027Clojurescript170529T054720Zmadstap
012Shell utils170527T201929ZCSM
019TXR Lisp170527T012929ZKaz
002Chip170526T194651ZPhlarx
017Lua170526T184805ZDelya Er
006APL170525T133130ZUriel
002V170525T153846ZDJMcMayh
016Brainfuck170526T123046ZMika Lam
023Python170526T073632Zspark
032C170526T074118ZKhaled.K
024Java 8170526T071748ZKevin Cr
nan170525T161246ZShaun Be
021PowerShell170525T135950Zcolsw
018PowerShell170526T040939Zbriantis
016Bash170526T024229ZRJHunter
030C170525T221542ZMD XF
006Cubix170525T221814ZMickyT
002Convex170525T221721ZGamrCorp
007sed170525T214752ZRiley
027REXX 27 Bytes170525T210707Ztheblitz
131x64 ASSEMBLY linux nasm170525T203711ZSamuel
017pb170525T192603Zundergro
022JavaScript ES8170525T191731ZShaggy
028BrainFlak170525T191201ZRiley
007Haskell170525T125730ZLaikoni
010Perl 6170525T165702ZSean
031C170525T161234Zsigvaldm
023Rust170525T160828ZTheLetha
031C tcc170525T150000Zcleblanc
007><>170525T143806ZAGourd
015Scala170525T142242Zjaxad012
003APL Dyalog170525T141508ZAdá
019Python170525T125938ZGáb
002Jelly170525T140040ZErik the
019tcl170525T135332Zsergiol
025Lua170525T133247ZFelipe N
004CJam170525T133038ZBusiness
021Mathematica170525T132959Zalephalp
018Excel170525T132913ZEngineer
028PHP170525T132459ZJör
004Gema170525T132252Zmanatwor
005Retina170525T132203ZNeil
014Octave170525T131722Zalephalp
024C#170525T125414ZTheLetha
036PHP170525T130915ZMayube
018brainfuck170525T130538ZNitrodon
022JavaScript ES6170525T125536ZTom
030Mathematica170525T130248ZZaMoC
022SmileBASIC 3170525T125933Zsnail_
001Japt170525T125910ZTom
023JavaScript ES6170525T125755ZJustin 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" "$)

BrainChild, 48 37 bytes

include*;gets("")(int c=>putchar(32))

Try It Online!

, 4 chars

code

⨝○󷺼𝘀

A simple test is here.

Explanation

explanation

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

Example

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.

AWK, 12 10 bytes

NR>1,$0=FS

Attempt This Online!

gsub(/./,FS)

Attempt This Online!

Zsh, 11 bytes

tr -c \  \ 

Try it online!

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. That took a while to type.enter image description here

(,) 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⁻ṣ

Attempt This Online!

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))}

Attempt This Online!

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_*

Attempt This Online!

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

Python 3, 36 bytes

lambda x:re.sub('.',' ',x)
import re

Try it online!

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

enter image description here


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/ 

Try it online!

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

Try it

S     :Implicit map of each character in input string
S     :Literal space

Less Trivial (w/o flag), 3 bytes

r.S

Try it

r.S     :Implicit input of string
r       :Replace
 .      :RegEx /./g
  S     :With space

Even Less Trivial, 6 bytes

©SißUÅ

Try it

©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)#""}

Try it online!

-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

Try it online!

Since str manipulates streams byte-by-byte, this outputs 1 space for each input character.

Factor, 20 bytes

[ [ drop bl ] each ]

Try it online!

For each character in the input string, drop it from the data stack and output a space.

Vyxal, 2 bytes

LI

Try it Online!

Vyxal S, 2 bytes

Try it Online!

If we want to port the Jelly answer, then:

Vyxal rs, 3 bytes

fð•

Try it Online!

Duocentehexaquinquagesimal, 7 bytes

1Â×^c¤E

Try it online!

Powershell, 18 12 bytes

-6 bytes thanks @Julian

$args|%{' '}

Try it online!

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ð*

Try it Online!

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:

05AB1E, 3 bytes

gð×

Try it online!

gð×  # full program
 ð   # a space...
  ×  # repeated...
g    # length of input...
  ×  # times

Nim, 38 bytes

for _ in stdin.readAll:stdout.write" "

Try it online!

Since Nim is style-insensitive, something like this also works:

fOr _ iN sTdIn.rEaDaLl:sTdOuT.wRiTe" "

Try it online!

GolfScript, 3 bytes

,n*

Try it online!

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 /.

Add++, 21 bytes

D,f,@@,bL*
$f>" ">?
o

Try it online!

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

Try it online!

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

 ,
\"@

Try it online!

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

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

Try it online!

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>

Java, 24 bytes

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

TIO

Gol><>, 5 bytes

iEH~a

Try it online!

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.

Python 3, 23 bytes

print(' '*len(input()))

Try it online!

Ahead, 12 bytes

S0d3-' \k:W@

Try it online!

Kotlin, 20 bytes

{" ".repeat(length)}

{" ".repeat           // repeat space
           (length)}  // length of input

Try it online!

GolfScript, 5 bytes

Port of CJam answer.

," "*

Try it online!

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));}}

Try Online

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.

enter image description here

Cascade, 14 11 9 8 bytes

? .'
,^\

Try it online!

-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

Try it online!

thanks to Jo King.

Keg,-lp -ir, 3 bytes

( ,

Try it online!

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͍*@

Try it online!

Note that spaces and newlines need to be escaped in the input, as input is automatically split otherwise.

Ruby -p, 10 bytes

$_=$/*~/$/

Try it online!

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ð?

Try it online!

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

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

Try it online!

{}                  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

Try it online!

The misspelling is intentional. (...or is it?)

Wren, 22 bytes

Multiply the space by the length of the string.

Fn.new{|a|" "*a.count}

Try it online!

Java (JDK), 84 bytes

static String m(String n){int i=0;String d="";while(i++<n.length())d+=" ";return d;}

Try it online!

J, 4 bytes

LF"0

Try it online!

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

Try it online!

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

Octave / Matlab, 25 23 bytes

@(x)repmat(' ',size(x))

Saved 2 bytes thanks to Giuseppe

Try it online!

R, 37 23 bytes

gsub("."," ",scan(,""))

Try it online!

14 bytes saved by ngm.

dc, 12 bytes

Z256r^25.5/P

Try it online!

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

Try it online!

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"

Try it online!

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)

Try it online!

^ 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>

Try it online!

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

Try it online!

Quite straight forward : replaces every character with a space.

dc, 25 18 bytes

-1 byte thanks to brhfl

Z[1-d0<L32P]sLd0<L

Try it online!

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,];

Try it online!

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.

Try it online!

dc, 18 bytes

?Zd[9P1-d0<r]sr0<r

Try it online!

Befunge-98 (PyFunge), 5 bytes

#@~a,

Try it online!

For every character in the input (#@~), this prints a new line (a,).

Pyth, 3 bytes

*dl

Try it!

Python equivalent: len(input())*" "

jmk

Try this!

Python equivalent: "\n".join(map("", input()))

smb

Try that!

Python equivalent: "".join(map("\n",input())

VQk

Try!

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.

Common Lisp, 32 bytes

(format t"~va"(length(read))#\ )

Try it online!

J, 6 bytes

' '#~#

Try it online!

Explanation

' '#~#
   #~    repeat
' '      spaces
     #   for length of input

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.

Ruby, 12 11+1 = 13 12 bytes

Uses the -p flag. -1 byte from Martin Ender.

gsub /./,$/

Try it online!

Hexagony, 12 11 bytes

-1 byte thanks to Martin Ender

,<.;.M@.>~8

Try it online!

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)

Try it online!

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:

The resulting program looks like this:

f(char *a){while(*a++)putchar(' ');}

How that works:

Try it online!

Whitespace, 311 150 77 68 65 46 41 38 bytes

-3 bytes thanks to Kevin Cruijssen
-27 bytes thanks to Ephphatha


  
   	 	 
 
  
 	
	 			
	  
	
  
 


Try it online!

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

Try it online!

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.

V, 2 bytes

Ò 

Try it online!

Note the trailing space!

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("."," ")

Try it here.

Java 7, 49 bytes

String c(String s){return s.replaceAll("."," ");}

Try it here.

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.

PowerShell, 21 bytes

[char[]]"$args"|%{""}

Try it online!

prints newlines.

PowerShell, 18 bytes

' '*"$args".Length

Try it online!

Bash, 16 bytes

printf %*s ${#1}

Try it online!

Uses parameter expansion count the length of the argument ${#1}, and then printf to output an empty string space-padded to that same length.

C, 57 33 30 bytes

-3 thanks to Tas.

f(int*a){while(*a++)puts("");}

Try it online!

Cubix, 6 bytes

Wahoo a 6 byter!

wi?@oS

Cubified

  w
i ? @ o
  S

Try it online!

Convex, 2 bytes

,*

Try it online!

Simply takes the length of the input and multiplies by newlines (which are at the bottom of the stack)

sed, 7 bytes

s/./ /g

Try it online!

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

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

Try it online!

{{}                    }     # 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.

Perl 6, 10 bytes

{S:g/./ /}

Basic string substitution.

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!

C (tcc), 31 bytes

I opted to output newlines since it's shorter...

f(char*s){for(;*s++;puts(""));}

Try it online!

><>, 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/⍪

Try it online!

 table (makes string into column matrix)

0/ replicate each column zero times

Python, 19 bytes

lambda s:' '*len(s)

Jelly, 2 bytes

⁶ṁ

Try it online!

tcl, 19

regsub -all . $s \ 

demo

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.

Lua, 25 bytes

for i=1,#...do
print()end

Same length as:

io.write((' '):rep(#...))

Try it online!

CJam, 4 bytes

q,S*

Try it online!

Explanation

q     e# Read input
 ,    e# Length
  S*  e# Repeat space that many times

Mathematica, 21 bytes

StringReplace[_->" "]

Excel, 18 bytes

=REPT(" ",LEN(A1))

Pretty boring and one byte longer than the VBA answer.

PHP, 28 Bytes

for(;a&$argn[$i++];)echo" ";

Try it online!

PHP, 29 Bytes

<?=str_pad('',strlen($argn));

Try it online!

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]));

Try it online!

Outputs newlines because spaces are too mainstream

brainfuck, 18 bytes

++++++++++>,[<.>,]

Try it online!

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$);

Japt, 1 byte

ç

Try it online!

JavaScript (ES6), 23 bytes

s=>" ".repeat(s.length)