Skip to main content
Tweeted twitter.com/StackCodeGolf/status/1609610418892247040
Became Hot Network Question
added 293 characters in body
Source Link
bigyihsuan
  • 11.5k
  • 1
  • 30
  • 70

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.
  • This is not a transpose challenge a transpose challenge;; each input string in the input list of strings has newlines separating each character. The "multi-line strings vs list of strings as input" default does not apply here; each string in the test cases are separated by --- and include newlines.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.
  • This is not a transpose challenge; each input string has newlines separating each character.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.
  • This is not a transpose challenge; each string in the input list of strings has newlines separating each character. The "multi-line strings vs list of strings as input" default does not apply here; each string in the test cases are separated by --- and include newlines.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)
emphasis on how this is not a transpose challenge
Source Link
bigyihsuan
  • 11.5k
  • 1
  • 30
  • 70

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple linesspanning across multiple lines. Each character, except for the last one, has a newline characteris separated by a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.
  • This is not a transpose challenge; each input string has newlines separating each character.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, has a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.
  • This is not a transpose challenge; each input string has newlines separating each character.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)
Fixed formatting
Source Link
The Thonnu
  • 18.7k
  • 3
  • 19
  • 76

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, has a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)
```

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, has a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)
```

Write the shortest possible program or function that will join a list of columnar strings.

For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, has a newline character. Some examples, separated by ---:

a
b
c
d
---
h
e
l
l
o
---
c
o
d
e
 
g
o
l
f
---
"
q
u
o
t
e
s
"

Given a list of columnar strings, join them into a single string with multiple columns. If the columnar string is longer than its surroundings, it should be left-padded by spaces.

Notes

  • This is , so shortest code wins!
  • You may assume inputs are ASCII only.
  • You may have trailing newlines.
  • You may have trailing spaces.

Test Cases

Input:
---
a
b
c
d
---
h
e
l
l
o
---
c
o
d
e

g
o
l
f
---
"
q
u
o
t
e
s
"
---
Output: (note how `hello` and `code golf` are left-padded by spaces)
ahc"
beoq
cldu
dleo
 o t
  ge
  os
  l"
  f


Input:
---
h
w
---
e
o
---
l
r
---
l
l
---
o
d
---
Output:
hello
world

Input:
---
p

f
---
b
m
v
---
t

s
---
d
n
z
---
k

x
---
g
N
h
---
Output:
pbtdkg
 m n N
fvszxh

Input:
---
1
---

2
---


3
---



4
---
6



5
---
Output:
1   6
 2
  3
   4
    5

Input:
---
a

c
---
|
---
b
d
---
Output:
a|b
  d
c

Input:
---
Output:
(empty output, or single newline)
Source Link
bigyihsuan
  • 11.5k
  • 1
  • 30
  • 70
Loading