Skip to main content
deleted 1 character in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

CJam, 15 13 11 bytes

A: rl"
B: <SP>
C: <LF>",(*SNq

Try it online in the [CJam interpreter][1].

How it works

e# A

r     e# Read a whitespace-separated token from STDIN.
      e# This reads the input up to the first space, but does not consume it.
l     e# Read the rest of the first line from STDIN.
      e# This reads up to the first linefeed and consumes it.

"     e# Initiate a string.

e# B

<SP>  e# Fill the string with as many spaces as there are copies of B.

e# C

<LF>" e# Terminate the string with a linefeed.
      e# This serves as a delimiter for the `l' command.
,(    e# Compute the length of the string minus 1 (to account for the LF).
*     e# Repeat the string read by `l' that many times.
SN    e# Push a space and a linefeed.
q     e# Read the remaining input (i.e., the second line) from STDIN.

At the end, the stack contains the token read by r, the space produced by *, the space and linefeed pushed by SN and the line read by q. CJam prints all these automatically.

[1]: http://cjam.aditsu.net/#code=rl%22%0A%22%2C(*SNq&input=rl%22%0A%22%2C(*SNq

CJam, 15 13 11 bytes

A: rl"
B: <SP>
C: <LF>",(*SNq

Try it online in the [CJam interpreter][1].

[1]: http://cjam.aditsu.net/#code=rl%22%0A%22%2C(*SNq&input=rl%22%0A%22%2C(*SNq

CJam, 15 13 11 bytes

A: rl"
B: <SP>
C: <LF>",(*SNq

Try it online in the [CJam interpreter][1].

How it works

e# A

r     e# Read a whitespace-separated token from STDIN.
      e# This reads the input up to the first space, but does not consume it.
l     e# Read the rest of the first line from STDIN.
      e# This reads up to the first linefeed and consumes it.

"     e# Initiate a string.

e# B

<SP>  e# Fill the string with as many spaces as there are copies of B.

e# C

<LF>" e# Terminate the string with a linefeed.
      e# This serves as a delimiter for the `l' command.
,(    e# Compute the length of the string minus 1 (to account for the LF).
*     e# Repeat the string read by `l' that many times.
SN    e# Push a space and a linefeed.
q     e# Read the remaining input (i.e., the second line) from STDIN.

At the end, the stack contains the token read by r, the space produced by *, the space and linefeed pushed by SN and the line read by q. CJam prints all these automatically.

[1]: http://cjam.aditsu.net/#code=rl%22%0A%22%2C(*SNq&input=rl%22%0A%22%2C(*SNq

deleted 1 character in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

CJam, 15 1313 11 bytes

A: rl"
B: <space><SP>
C: <linefeed>"<LF>",(*S+N+l*SNq

Try it online in the CJam interpreter[CJam interpreter][1].

[1]: http://cjam.aditsu.net/#code=rl%22%0A%22%2C(*SNq&input=rl%22%0A%22%2C(*SNq

CJam, 15 13 bytes

A: rl"
B: <space>
C: <linefeed>",(*S+N+l

Try it online in the CJam interpreter.

CJam, 15 13 11 bytes

A: rl"
B: <SP>
C: <LF>",(*SNq

Try it online in the [CJam interpreter][1].

[1]: http://cjam.aditsu.net/#code=rl%22%0A%22%2C(*SNq&input=rl%22%0A%22%2C(*SNq

added 17 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

CJam, 1515 13 bytes

A: q34c/~\,"rl"
B: <space>
C: "*S+`\<linefeed>",(*S+N+l

Try it online in the CJam interpreter.

CJam, 15 bytes

A: q34c/~\,"
B: <space>
C: "*S+`\

Try it online in the CJam interpreter.

CJam, 15 13 bytes

A: rl"
B: <space>
C: <linefeed>",(*S+N+l

Try it online in the CJam interpreter.

Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825
Loading