[Question]
  [
Given as input a positive integer `n>=1`, output the first `n` rows of the following triangle:
```
                  1
                1 0 1
              0 0 1 0 0
            1 1 1 0 1 1 1
          0 0 0 0 1 0 0 0 0
        1 1 1 1 1 0 1 1 1 1 1
      0 0 0 0 0 0 1 0 0 0 0 0 0
    1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
  0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
```
The rows alternate between all zeroes and all ones, except the center column is flipped.
## Test cases
* **Input**: `3`
* **Output**: 
```
    1
  1 0 1
0 0 1 0 0
```
* **Input**: `10`
* **Output**: 
```
                  1
                1 0 1
              0 0 1 0 0
            1 1 1 0 1 1 1
          0 0 0 0 1 0 0 0 0
        1 1 1 1 1 0 1 1 1 1 1
      0 0 0 0 0 0 1 0 0 0 0 0 0
    1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
  0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1
```
Your code must work for any `n<100`. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), hence the shortest code in bytes wins!
Trailing spaces / newlines and leading newlines are allowed!
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
Ṭ=Ḃµ€ŒB
```
[Try it online!](https://tio.run/##ARoA5f9qZWxsef//4bmsPeG4gsK14oKsxZJC////Mw "Jelly – Try It Online")
-1 byte thanks to Erik the Outgolfer
# Explanation
```
Ṭ=Ḃµ€ŒB  Main link
    €    For each element in (implicit range of) the input:
Ṭ        List 1s and 0s with 1s in the indices in the left argument (generates `[0, 0, ..., 1]`)
 =Ḃ      Is this equal to `(z % 2)` where `z` is the range number? (Every other row is flipped)
     ŒB  Reflect each row
```
[Answer]
# [Python 2](https://docs.python.org/2/), 50 bytes
```
lambda n:[i*`i%2`+`~i%2`+i*`i%2`for i in range(n)]
```
**[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjpTKyFT1ShBO6EOTEG5aflFCpkKmXkKRYl56akaeZqx/wuKMvNKNNI0jDU1uWBsQwNNzf@GBgA "Python 2 – Try It Online")**
This returns the rows as a list of Strings.
# [Python 2](https://docs.python.org/2/), ~~67 65~~ 63 bytes (formatted)
```
n=input()
for i in range(n):k=i*`i%2`;print(n-i)*" "+k+`~i%2`+k
```
**[Try it online!](https://tio.run/##K6gsycjPM/r/P882M6@gtERDkystv0ghUyEzT6EoMS89VSNP0yrbNlMrIVPVKMG6oCgzr0QjTzdTU0tJQUk7WzuhDiSunf3/v6EBAA "Python 2 – Try It Online")**
This outputs with a trailing space on each line.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
⁼€=ḂŒḄµ€
```
[Try it online!](https://tio.run/##y0rNyan8//9R455HTWtsH@5oOjrp4Y6WQ1uBvP///xsaAAA "Jelly – Try It Online")
-2 thanks to [HyperNeutrino](https://codegolf.stackexchange.com/users/68942/hyperneutrino).
[Answer]
# [Python 2](https://docs.python.org/2/), 50 bytes
```
lambda n:[[i%2]*i+[~i%2]+i*[i%2]for i in range(n)]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjo6U9UoVitTO7oOxNDO1AILpOUXKWQqZOYpFCXmpadq5GnG/i9JLS4pVrBViDbWUTA0iOXigqsBy1hxKQBBQVFmXolCmkam5n8A "Python 2 – Try It Online")
# [Python 2](https://docs.python.org/2/), 53 bytes
```
lambda n:[(([i%2]*i+[~i%2])*2)[:-1]for i in range(n)]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKlpDIzpT1ShWK1M7ug7E0NQy0oy20jWMTcsvUshUyMxTKErMS0/VyNOM/V@SWlxSrGCrEG2so2BoEMvFBVcDlrHiUgCCgqLMvBKFNI1Mzf8A "Python 2 – Try It Online")
# [Python 2](https://docs.python.org/2/), 67 bytes
```
lambda n:[[[i%2,~i%2][j==i]for j in range(2*i+1)]for i in range(n)]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjo6OlPVSKcOSMRGZ9naZsam5RcpZClk5ikUJealp2oYaWVqG2qCRTMRonmasf9LUotLihVsFaKNdRQMDWK5uOBqwDJWXApAUFCUmVeikKaRqfkfAA "Python 2 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~12~~ 9 bytes
```
õÈÇ¥Y^uÃê
```
[Test it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=9cjHPDFeWXXDdyDq&input=NSAtUg==)
~~Quite~~ Slightly sad compared to Jelly, but Japt doesn't have anything like `Ṭ` so I must make do with what I have...
### Explanation
```
 õÈ   Ç   ¥ Y^ uÃ ê
UõXY{XoZ{Z==Y^Yu} ê}      Ungolfed
                          Implicit: U = input number
Uõ                        Create the range [1..U].    [1, 2, 3, 4]
  XY{              }      Map each item X and 0-index Y in this to
     Xo                     Create the range [0..X).  [[0], [0, 1], [0, 1, 2], [0, 1, 2, 3]]
       Z{      }            Map each item Z in this to
         Z==Y                 Z is equal to Y         [[1], [0, 1], [0, 0, 1], [0, 0, 0, 1]]
             ^Yu              XORed with Y % 2.       [[1], [1, 0], [0, 0, 1], [1, 1, 1, 0]]
                  ê         Bounce.                   [[1],
                                                       [1, 0, 1],
                                                       [0, 0, 1, 0, 0],
                                                       [1, 1, 1, 0, 1, 1, 1]]
                          Implicit: output result of last expression
```
[Answer]
# Mathematica, 77 bytes
```
Table[CellularAutomaton[51,{{1},0},#,{All,All}][[i]][[#-i+2;;-#+i-2]],{i,#}]&
```
**@Not a tree** golfed it down to 48 bytes!
# Mathematica, 48 bytes
```
#&@@@NestList[CellularAutomaton@51,{{1},0},#-1]&
```
[Answer]
# [Pyth](https://pyth.readthedocs.io), 14 bytes
*Thanks to @Jakube for saving 2 bytes!*
```
ms_+Bm%d2d%hd2
```
[Try it here!](https://pyth.herokuapp.com/?code=ms_%2BBm%25d2d%25hd2&input=10&debug=0)
# [Pyth](https://pyth.readthedocs.io), 15 bytes
*Thanks a lot to @Jakube for -1 byte*
```
m++K*d]%d2%td2K
```
[Try it here.](https://pyth.herokuapp.com/?code=m%2B%2BK%2ad%5D%25d2%25td2K&input=10&debug=0)
# [Pyth](https://pyth.readthedocs.io), 16 bytes
```
m++K*d`%d2`%td2K
```
[Try it here.](https://pyth.herokuapp.com/?code=m%2B%2BK%2ad%60%25d2%60%25td2K&input=10&debug=0)
[Answer]
# [R](https://www.r-project.org/), 73 bytes
Thanks to Giuseppe! Nice catch.
```
n=scan();for(i in 1:n)cat(c(rep(" ",n-i),x<-rep(1-i%%2,i-1)),i%%2,x,"\n")
```
[Try it online!](https://tio.run/##Hcc7CoAwDADQq5RAIYEEjKOfm7iUopAlSnXo7SO6vdcifL1rcaT5OBtaMk86OdXyYMW2XwgJ2MWI@yLfVSznkU2UiH92hs2BQod4AQ "R – Try It Online")
# [R](https://www.r-project.org/), 78 bytes
```
n=scan();for(i in 1:n)cat(x<-c(rep(" ",n-i),rep(1-i%%2,i-1)),i%%2,rev(x),"\n")
```
[Try it online!](https://tio.run/##Hcc7CoAwDADQq5RCIYEErKOfm7iUUiFLlCjS20d0e8/cdb1qUcB5PwwkiIY8KdZyQ1@4grUTYoikLEhfMktKIwlnRPpp7YGOFDeN6HnwFw "R – Try It Online")
# [R](https://www.r-project.org/), 82 bytes
```
n=scan();for(i in 1:n){j=i%%2;x=c(rep(" ",n-i),rep(1-j,i-1));cat(x,j,rev(x),"\n")}
```
[Try it online!](https://tio.run/##FcgxCoAwDADAr5RCIYF0iKOlP3GRopAOUapIQXx71PGumWk@yqyAad0aiBN1PCreNUsIQ@q5QFt28M6TRkH6wbGSREZMZT6hU/32go7kJ/X4GLO9 "R – Try It Online")
# [R](https://www.r-project.org/), 110 bytes - output to stdout
```
m=matrix(x<-rep_len(0:1,n<-scan()),n,n-1);m[upper.tri(m,T)]=" ";for(i in 1:n)cat(rev(m[i,]),1-x[i],m[i,],"\n")
```
[Try it online!](https://tio.run/##HcpLCgIxDADQq5SuEkhlup3PLdzVImWoEDCxxBnp7au4fPBsDNmkHMYd@hqstvuzKkxzJF3Dey8KiKSkIeIi6Wyt2uW3QeiKefPOL4@XATtWF2fFvRxg9QOSmDJSDD1xpr/I39TjiNP4Ag "R – Try It Online")
# [R](https://www.r-project.org/), 130 bytes - output to a file
```
m=matrix(x<-rep_len(0:1,n<-scan()),n,n-1);m[upper.tri(m,T)]=" ";for(i in 1:n)cat(rev(m[i,]),1-x[i],m[i,],"\n",file="a",append=i>1)
```
[Try it online!](https://tio.run/##HcxNCsMgEEDhq4irGRhLXebHnqI7K0VSAwNxKiYt3t6GLh98vNp7djkelRu02dRUnlsSuI6WZDb7EgUQSUiMxSn7TympXk4Nme4YnFZ6Wt8VWLEoOwou8YCavpA9U0CypnkO9C/SD9G08pacjpriuZKX45vFPgz9Bw "R – Try It Online")
Writing out to a file as I do not know how to fit it in the console if `n==99` (see the result [here](https://gist.github.com/djhurio/00a298cbb06a2b8be0fac6d05f72bd2b)).
[Answer]
# [Pascal](https://www.freepascal.org/), ~~181~~ 154 bytes
*27 bytes saved thanks to @ThePirateBay*
```
procedure f(n:integer);var i,j:integer;begin for i:=1to n do begin write(' ':(n-i+1)*2);for j:=1to i*2-1do write((ord(j<>i)+i)mod 2,' ');writeln()end end;
```
[Try it online!](https://tio.run/##RY7dDoMgDIWv51P0TurPErxZArp3cQKm6sAwtz0@A41Zk/bi9PTrWfvX0C@1WYcQVu8Grd5eg2FWkN30qD3KT@@BqukU5EOPZMG4qIqObw4sKAeH@vW0aZZDLpitqeRYNCiTdTqsVDQ1j@7Dx5xXbGrvhCXh0yloqniKct8ulqG2CmLLkDLMAs4I2f4tuyTyDKIDDhF@@@cwbEYJJyfvUkXwDsviuIYf)
**Unglofed**
```
procedure f (n: integer);
    var i, j: integer;
    begin
        for i := 1 to n do
        begin
            write(' ': (n-i+1) * 2);
            for j := 1 to i*2-1 do
                write((ord(j<>i) + i) mod 2, ' ')
            writeln()
        end
    end;
```
[Answer]
# [Retina](https://github.com/m-ender/retina), 25 bytes
```
.+
$*0
0
1$`¶
T`d`10`¶.*¶
```
[Try it online!](https://tio.run/##K0otycxL/P9fT5tLRcuAy4DLUCXh0DaukISUBEMDIEtP69C2//8NDQA "Retina – Try It Online") Explanation: The first stage converts the input into a string of zeros of that length. The second stage then takes all of the prefixes of that string (not including the string itself) and prefixes a 1 to them. The third stage then toggles the bits on alternate lines.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 24 21 18 [bytes](https://github.com/Adriandmen/05AB1E/blob/master/docs/code-page.md)
```
FNÉN×NÈJûIN>-úˆ}¯»
```
[Try it online!](https://tio.run/##ASYA2f8wNWFiMWX//0ZOw4lOw5dOw4hKw7tJTj4tw7rLhn3Cr8K7//8xMA)
---
Edit: Well, it is my first 05AB1E golf so I'm not surprised things can be golfed. Edit history:
* 18 (see above)
	+ So there *is* a intersect mirror (both [`.∞`](https://github.com/Adriandmen/05AB1E/blob/master/docs/info.txt#L358) and [`û`](https://github.com/Adriandmen/05AB1E/blob/master/docs/info.txt#L302)), which eases up things a lot
	+ As do [`È` and `É`](https://github.com/Adriandmen/05AB1E/blob/master/docs/info.txt#L251-L252), making `2%` and `2%_` a lot shorter
* 21: [`FN2%DN×Dr_sJIN>-úˆ}¯»`](https://tio.run/##MzBNTDJM/f/fzc9I1cXv8HSXovhiL08/O93Du0631R5af2j3//@GBgA)
	+ Removed implicit stuff: `IF` -> `F`, `)J` -> `J`
	+ `baa` to `aab` can be done by [`.À` (rotating)](https://github.com/Adriandmen/05AB1E/blob/master/docs/info.txt#L354) but also by [`r` (reversing)](https://github.com/Adriandmen/05AB1E/blob/master/docs/info.txt#L116) (shorter)
* 24: [`IFN2%DN×D.À_s)JIN>-úˆ}¯»`](https://tio.run/##MzBNTDJM/f/f083PSNXF7/B0F73DDfHFml6efna6h3edbqs9tP7Q7v//DQ0A)
[Answer]
# [Perl 5](https://www.perl.org/), 58 + 1 (-n) = 59 bytes
```
say$"x(2*--$_).($/=$i%2 .$")x$i.(1-$i%2).$".$/x$i++while$_
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVJFqULDSEtXVyVeU09DRd9WJVPVSEFPRUmzQiVTT8NQF8TXBPL1VPSBItra5RmZOakq8f//m/zLLyjJzM8r/q/ra6pnYGjwXzcPAA "Perl 5 – Try It Online")
~~# [Perl 5](https://www.perl.org/), 59 + 1 (-n) = 60 bytes~~
```
say$"x(2*--$_).($i%2 .$")x$i.(1-$i%2).($".$i%2)x$i++while$_
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVJFqULDSEtXVyVeU09DJVPVSEFPRUmzQiVTT8NQF8QHCSvpgVlAUW3t8ozMnFSV@P//Tf7lF5Rk5ucV/9f1NdUzMDT4r5uXCAA "Perl 5 – Try It Online")
[Answer]
# Mathematica, 90 bytes
```
Array[(x=Table[1,f=(2#-1)];x[[⌈f/2⌉]]=0;If[#==1,{1},If[OddQ@#,x/.{1->0,0->1},x]])&,#]&
```
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), 13 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
∫:2\r*Kr1κ+╥T
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUyMjJCJTNBMiU1Q3IqS3IxJXUwM0JBKyV1MjU2NVQ_,inputs=NQ__)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 18 bytes
```
ＥＮ⪫ＩＥ⁺¹ι﹪⁺ι¬λ² ‖Ｏ←
```
[Try it online!](https://tio.run/##JYxBCsIwEEX3niJ0NYEUbJd26UqxtfQGMaYYGDMlmfT6Y6Sb/@A9@O5jkyOLInMKkWG0G9ziVngq35dPoI26U4hwtfmIM5YMnVGhlpHeBelQwaiJGFBX3@v/NqqpHE6LX9E7fu4@YT24PPzKehDpztLu0mb8AQ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＥＮ              For each of the input number of rows
  ⪫             Join with spaces
   Ｉ            Convert to string
    Ｅ⁺¹ι        For each column
        ﹪⁺ι¬λ²  Calculate the digit
‖Ｏ←             Reflect to the left
```
[Answer]
# JavaScript, ~~140~~ 132 bytes (with proper formatting)
```
n=>{A=Array;a='';b=0;for(x of A(n)){for(c of A(n-b))a+=' ';for(c of A(b))a+=b%2;a+=(b+1)%2;for(c of A(b))a+=b%2;a+='\n';b++}return a}
```
[Try It Online](https://tio.run/##dY7BCsIwEER/JRdJllCpvYYI/Q8vm5hKpezKNhWl9NtjRA9ePM3Mm8PMFe84RxlvuSE@p5Jl9IX8ce19L4JPh15rF3zrBhbzUDyo3hDA@o7xG5sAgNZrpd0P/sCw61wVE@wBqv3X6xPVGWs3SXkRUriVyDTzlPYTX0y9ZboWoLwA)
[Answer]
# [JavaScript (ES6)](https://babeljs.io/), ~~74~~ ~~73~~ ~~71~~ ~~68~~ 64 bytes
**-7 bytes** by @Neil
```
f=n=>n--?[...f(n), [...Array(n-~n)].map((v,i)=>(n+(i==n))%2)]:[]
```
[Try it online!](https://tio.run/##FcbBCoMwDADQX/EiJMzkMNhlI8q@Q3qIrpWOLpU6BC/@esfe6b11120ucf3SpJNPZPnlaw1i0hvRMDJzAMOu@e9Zih5gdBo6/ugKsHcRpQe7QBQxxPaK7j66OmfbcvKc8gIBboiP@gM "JavaScript (ES6) – Try It Online")
Simple recursive function that generates the lines one by one. Outputs as array of array of numbers.
---
Outputs as formatted string:
# [JavaScript (ES6)](https://babeljs.io/), ~~122~~ ~~119~~ 118 bytes
```
f=(n,w=2*n+1,N=n,s=" ".repeat((N-n)*2))=>(--n?f(n,w,N)+s+[...Array(n-~n)].map((v,i)=>(n+(i==n))%2).join(" "):s+1)+"\n"
```
[Try it online!](https://tio.run/##FcxLCsIwEADQq0hAmGk@2CyVUbxAL6Au0ppKSjspSam48erR7h9vcKvLXQrzolvX@lFzfPpSegJWb7IVy1o1xCqT2AmT/OzdAtBoxsoi0hm05ku/YdWgzPJmjLmm5D7A@sv4MJObAVYVNssSAhEj7i2aIQaGf4rHLGuU4s6idJFzHL0Z4wt6sAfEU/kB "JavaScript (Babel ES6) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 54 bytes
Straight forward list comprehension:
```
f n=[k++[mod i 2]++k|i<-[1..n],k<-[mod(i+1)2<$[2..i]]]
```
[Try it online!](https://tio.run/##DclBCsMgEEbhq/yLLhpsByJd6qrrnkCGIsSkg3ESEpe5u3Xx4IP3i2dO69raDPUhGxPKNkFg2Zh8iXuGkUj5kbv6uYsZB@tuwRIJM7cSReFR4v75Yj9EKwhz70hxgncOS6rvTWvSerbXHw "Haskell – Try It Online")
[Answer]
# J, 32 bytes
```
3 :'-.^:(2|y)(=|.)i.>:+:y'&.>@i.
```
[Try it online!](https://tio.run/##y/r/P81Wz1jBSl1XL85Kw6imUlPDtkZPM1PPzkrbqlJdTc/OIVOPiys1OSNfIU3B9P9/AA) This is an anonymous function that returns a boxed list of values.
I like to imagine that the explicit function definition saves bytes by virtue of removing caps and such, but it probably adds a few bytes in comparison to a tacit answer.
# Explanation
```
3 :'-.^:(2|y)(=|.)i.>:+:y'&.>@i.
                              i. For i = 0 ... input - 1
3 :'-.^:(2|y)(=|.)i.>:+:y'        Explicit function: compute nth row
                    >:+:y          2n+1
                  i.               Range [0,2n+1)
             (=|.)                 Equate range to reversed range
                                    (yield 0 0 0 ... 1 ... 0 0 0)
                                   If
                                    n = 1 (mod 2)
                                   Then
                                    Negate each value
                          &.>     Box
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 11 bytes
```
FN°SRNF_}ûˆ
```
[Try it online!](https://tio.run/##MzBNTDJM/f/fze/QhuAgP7f42sO7T7f9/29oAAA "05AB1E – Try It Online")
**Explanation**
```
F             # for N in range [0 ... input-1] do:
 N°           # push 10^N
   S          # split to list of digits
    R         # reverse
     NF_}     # N times do: logical negation
         û    # palendromize
          ˆ   # add to global list
              # implicitly display global list
```
[Answer]
# [J](http://jsoftware.com/), 17 bytes
```
(2&|~:0=i:)&.>@i.
```
[Try it online!](https://tio.run/##y/r/P03B1kpBw0itps7KwDbTSlNNz84hU4@LKzU5I18hTcEYwtDQMNJSjtFV1qzRU4o3VLJSs9MEShoa/P8PAA "J – Try It Online")
Outputs a list of boxed arrays.
## Explanation
```
(2&|~:0=i:)&.>@i.  Input: n
               i.  Range from 0 to n, exclusive end
           & >     Unbox each and perform on each x
        i:           Range from -x to x, inclusive
      0=             Equal to 0
    ~:               Not equal
 2&|                 x mod 2
           &.>       Perform inverse of unbox (box)
```
[Answer]
# Java 8, ~~121~~ ~~111~~ ~~109~~ 101 bytes
```
n->{String r[]=new String[n],t;for(int i=0,j;i<n;r[i++]=t+i%2+t)for(j=0,t="";j++<i;t+=i%2);return r;}
```
My current byte-score (101) is also a row of the binary triangle. :)
**Explanation:**
[Try it here.](https://tio.run/##jU/LasMwELz7K5ZAwUKJSNujokI/oLn0aHxQFaWsaq@MvE4Jwd/uyrHbcy8LOw9mJtiL3cXOUzh9Tdh2MTGEjKmBsVGvKdlrrwvX2L6HN4t0KwCQ2KezdR6O8wvwzgnps6rBlZkDEjrDY5FPz5bRwREIDEy0e7ktWkhVbch//1qp3rI@x3T3o9lvg8YD6VShlLVhiQ9PksUsCJlks9noIOUBNUuTOaGT5yERJD1Oeg7uho8mB6/5l4gnaHP98q@qFWv3a8@@VXFg1WWKGyqX1YrjIi5JufJZiPuqfxse96tjLMbpBw)
```
n->{                         // Method with integer parameter and String-array return-type
  String r[]=new String[n],  //  Result String-array
         t;                  //  Temp String
  for(int i=0,j;             //  Some index-integers
      i<n;                   //  Loop (1) from 0 to `n` (exclusive)
      r[i++]=                //    After every iteration, set the next row to:
        t+                   //     `t` +
        i%2                  //     Center digit (`i` has already been raised by 1 now)
        +t)                  //     + `t` again
    for(j=0,t="";            //   Reset index `j` and the temp-String `t`
        j++<i;               //   Inner loop (2) from 0 to `i` (exclusive)
      t+=i%2                 //    Append `t` with an outer digit
    );                       //   End of inner loop (2)
                             //  End of loop (1) (implicit / single-line body)
  return r;                  //  Return resulting String-array
}                            // End of method
```
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 49 bytes
```
~.:a;0\{..1+2%.!""+@*+" "a(:a*+.1>-1%\+"\n"+\)}*;
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/v07PKtHaIKZaT89Q20hVT1FJSdtBS1tJQSlRwypRS1vP0E7XUDVGWykmT0k7RrNWy/r/f0MDAA "GolfScript – Try It Online")
]