Skip to main content
added 56 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

CJam, 4242 40 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/W=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9"wertyuiop asdfghjkl zxcvbnm"q/Sf*N*+_q#))>W=S%Sf*N* 

&input=f" rel="nofollow noreferrer">Test it here.Test it here.

Explanation

S e# Push a space. "we...nm" e# Push the letters in order, without q. We don't need q, because it will never e# be part of the output, and by omitting it, the first two lines have the same e# length, which comes handy when we... 9/ e# Split the string into chunks of 9 characters. Sf* e# Join each line by spaces. N* e# Join the lines by linefeeds. + e# Prepend the space we pushed earlier. The resulting string now has the correct e# layout and a single whitespace character in front of each letter. q/ e# Split thatthe string around the input. If the input is "q", the entire string e# will go into a single chunk. W= e# Select the last chunk. 1>S% e# DiscardSplit the firststring characteraround spaces, discarding empty segments (ifonly thererelevant isfor one),the which   is e# first segment if the whitespaceinput inis front"p" or "l"). Sf* e# Join each e#line ofby thespaces. N* first letter wee# wantJoin tothe printlines by linefeeds. 

The other version works quite similarly, but instead of splitting the string, we find the position of the input with # (which gives -1) for q and then discard everything up to that position + 2.

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/W=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

Explanation

S e# Push a space. "we...nm" e# Push the letters in order, without q. We don't need q, because it will never e# be part of the output, and by omitting it, the first two lines have the same e# length, which comes handy when we... 9/ e# Split the string into chunks of 9 characters. Sf* e# Join each line by spaces. N* e# Join the lines by linefeeds. + e# Prepend the space we pushed earlier. The resulting string now has the correct e# layout and a single whitespace character in front of each letter. q/ e# Split that string around the input. If the input is "q", the entire string e# will go into a single chunk. W= e# Select the last chunk. 1> e# Discard the first character (if there is one), which is the whitespace in front e# of the first letter we want to print. 

The other version works quite similarly, but instead of splitting the string, we find the position of the input with # (which gives -1) for q and then discard everything up to that position + 2.

CJam, 42 40 bytes

"wertyuiop asdfghjkl zxcvbnm"q/W=S%Sf*N* 

Test it here.

Explanation

"we...nm" e# Push the letters in order, without q. We don't need q, because it will never e# be part of the output. q/ e# Split the string around the input. If the input is "q", the entire string e# will go into a single chunk. W= e# Select the last chunk. S% e# Split the string around spaces, discarding empty segments (only relevant for the     e# first segment if the input is "p" or "l"). Sf* e# Join each line by spaces. N* e# Join the lines by linefeeds. 
added 56 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/1=1>W=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

Explanation

S e# Push a space. "we...nm" e# Push the letters in order, without q. We don't need q, because it will never e# be part of the output, and by omitting it, the first two lines have the same e# length, which comes handy when we... 9/ e# Split the string into chunks of 9 characters. Sf* e# Join each line by spaces. N* e# Join the lines by linefeeds. + e# Prepend the space we pushed earlier. The resulting string now has the correct e# layout and a single whitespace character in front of each letter. q/ e# Split that string around the input. If the input is "q", the entire string e# will go into a single chunk. W= e# Select the last chunk. 1> e# Discard the first character (if there is one), which is the whitespace in front e# of the first letter we want to print. 

The other version works quite similarly, but instead of splitting the string, we find the position of the input with # (which gives -1) for q and then discard everything up to that position + 2.

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/1=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/W=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

Explanation

S e# Push a space. "we...nm" e# Push the letters in order, without q. We don't need q, because it will never e# be part of the output, and by omitting it, the first two lines have the same e# length, which comes handy when we... 9/ e# Split the string into chunks of 9 characters. Sf* e# Join each line by spaces. N* e# Join the lines by linefeeds. + e# Prepend the space we pushed earlier. The resulting string now has the correct e# layout and a single whitespace character in front of each letter. q/ e# Split that string around the input. If the input is "q", the entire string e# will go into a single chunk. W= e# Select the last chunk. 1> e# Discard the first character (if there is one), which is the whitespace in front e# of the first letter we want to print. 

The other version works quite similarly, but instead of splitting the string, we find the position of the input with # (which gives -1) for q and then discard everything up to that position + 2.

added 56 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/1=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/1=1> 

&input=f" rel="nofollow noreferrer">Test it here.

CJam, 42 bytes

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+q/1=1> 

or

S"wertyuiopasdfghjklzxcvbnm"9/Sf*N*+_q#))> 

&input=f" rel="nofollow noreferrer">Test it here.

Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999
Loading