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

Return to Answer

Added explanation
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

Perl 6, 43 bytes

{(0....comb-1...0)>>.&{join ' 'x$^a,.comb}}

Try it online!

Returns a list of lines.

Explanation:

 { } # Anonymous code block
 (0....comb-1...0) # A list from
 0 # 0
 ... # to
 .comb-1 # the length of the input string -1
 ... # back to
 0 # 0
 >>.&{ } # Map each number to
 join ,.comb # Join the list of characters
 ' 'x$^a # With the number of spaces

Perl 6, 43 bytes

{(0....comb-1...0)>>.&{join ' 'x$^a,.comb}}

Try it online!

Perl 6, 43 bytes

{(0....comb-1...0)>>.&{join ' 'x$^a,.comb}}

Try it online!

Returns a list of lines.

Explanation:

 { } # Anonymous code block
 (0....comb-1...0) # A list from
 0 # 0
 ... # to
 .comb-1 # the length of the input string -1
 ... # back to
 0 # 0
 >>.&{ } # Map each number to
 join ,.comb # Join the list of characters
 ' 'x$^a # With the number of spaces
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

Perl 6, 43 bytes

{(0....comb-1...0)>>.&{join ' 'x$^a,.comb}}

Try it online!

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