Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Print invisible text

Given a string as input, output a number of whitespace characters (0x0A and 0x20) equal to the length of the string.

For example, given the string Hello, World! your code would need to output exactly 13 whitespace characters and nothing else. These can be any mix of spaces and newlines.

Your code should not output any additional trailing newlines or spaces.

Testcases:

 Input -> Amount of whitespace to output
"Hello, World!" -> 13
"Hi" -> 2
" Don't
Forget about
Existing
Whitespace! " -> 45
"" -> 0
" " -> 13
"
" -> 1

Scoring:

This is so fewest bytes wins!

Answer*

Draft saved
Draft discarded
Cancel
2
  • 1
    \$\begingroup\$ You can go down 6 bytes using splatting ? Try it online! \$\endgroup\$ Commented Apr 14, 2021 at 1:22
  • 1
    \$\begingroup\$ Thanks. Three years ago we didn't use splatting. Thanks again. \$\endgroup\$ Commented Apr 14, 2021 at 4:34

AltStyle によって変換されたページ (->オリジナル) /