[Question]
  [
Given a character, output (to the screen) the entire qwerty keyboard layout (with spaces and newlines) that follows the character. The examples make it clear.
Input 1
```
f
```
Output 1
```
g h j k l
z x c v b n m
```
Input 2
```
q
```
Output 2
```
w e r t y u i o p
a s d f g h j k l
z x c v b n m
```
Input 3
```
m
```
Output 3
(Program terminates without output)
Input 4
```
l
```
Output 4
```
z x c v b n m
```
**Shortest code wins.** (in bytes)
P.S.
Extra newlines, or extra spaces at the end of a line are accepted.
  
[Answer]
## CJam, ~~42~~ 40 bytes
```
"wertyuiop asdfghjkl zxcvbnm"q/W=S%Sf*N*
```
[Test it here.](http://cjam.aditsu.net/#code=%22wertyuiop%20asdfghjkl%20zxcvbnm%22q%2FW%3DS%25Sf*N*&input=f)
### 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.
```
[Answer]
# Pyth, 33 bytes
```
jjL\ cec."`zÈ´ýß44,ûtKÕÀ@"z\`
```
Note that some characters are unprintable. Try it online in the [Pyth Compiler](https://pyth.herokuapp.com/?code=jjL%5C+cec.%22%60z%01%1E%C3%88%10%C2%B4%C3%BD%C3%9F44%2C%C3%BBtK%C3%95%C3%80%04%40%22z%5C%60&input=f&debug=0).
### How it works
```
jjL\ cec."`z…"z\`
        ."`z…"     Unpack …, with lowest character '`' and highest character `z`.
       c      z    Split at occurrences of the input (z).
      e            Retrieve the last resulting chunk.
     c         \`  Split into rows, at backticks.
 jL\               Separate the characters of each row by spaces.
j                  Separate the rows by linefeeds.
```
[Answer]
# Perl, 56 bytes
```
#!perl -p
'qwertyuiop
asdfghjkl
zxcvbnm'=~/$_
?/;$_=$';s/\B/ /g
```
Counting the shebang as 3, input is taken from stdin. If a leading newline isn't a concern for inputs `p` and `l`, then `/$_\n?/` could be replaced with a bare `$_` to save 4.
---
**Sample Usage**
```
$ echo g|perl qwerty.pl
h j k l
z x c v b n m
$ echo v|perl qwerty.pl
b n m
```
[Answer]
# [GS2](https://github.com/nooodl/gs2), ~~38~~ 37 bytes
```
♦wertyuiop asdfghjkl zxcvbnm♣B3$,■♪2◙
```
The source code uses the [CP437](https://en.wikipedia.org/wiki/Code_page_437#Characters) encoding. [Try it online!](http://gs2.tryitonline.net/#code=4pmmd2VydHl1aW9wIGFzZGZnaGprbCB6eGN2Ym5t4pmjQjMkLOKWoOKZqjLil5k&input=Zg)
### Test run
```
$ base64 -d > qwerty.gs2 <<< BHdlcnR5dWlvcCBhc2RmZ2hqa2wgenhjdmJubQVCMyQs/g0yCg==
$ wc -c qwerty.gs2
37 qwerty.gs2
$ echo -n f | gs2 qwerty.gs2
g h j k l
z x c v b n m
```
### How it works
```
♦                                      Begin string literal.
 wertyuiop asdfghjkl zxcvbnm
                            ♣          End string literal.
                             B         Swap the string with the input.
                              3        Split the string at the input character.
                               $       Select the last chunk.
                                ,      Split the selected chunk at spaces.
                                 ■     Map over the resulting array:
                                  ♪      Push ' '.
                                   2     Join the characters, separating by ' '.
                                    ◙    Push a linefeed.
```
[Answer]
# JavaScript (ES6), 60 bytes
```
x=>[...`qwertyuiop
asdfghjkl
zxcvbnm`].join` `.split(x)[1]
```
Uses the same technique as most other answers. Suggestions welcome!
[Answer]
# C#, 112 bytes ~~105~~ ~~110~~
Count went up by 5 bytes, but more correct! Thanks @MartinBüttner!!
```
void c(char i){System.Console.Write(@"q w e r t y u i o p
a s d f g h j k l
z x c v b n m".Split(i)[1].Trim());}
```
Un-golfed
```
void c(char i)
{
    System.Console.Write(@"q w e r t y u i o p
    a s d f g h j k l
    z x c v b n m".Split(i)[1].Trim());
}
```
[Answer]
## Python, 83 bytes
```
lambda c,s="q w e r t y u i o p\na s d f g h j k l\nz x c v b n m":s[s.index(c)+2:]
```
[Try it online](http://ideone.com/fork/mYlGTU)
[Answer]
# Ruby, ~~63~~ 57 bytes
Takes the character as command line argument: `ruby keyboard.rb e`
```
"qwertyuiop
asdfghjkl
zxcvbnm".scan$*[0]
puts$'.chars*' '
```
[Answer]
# [TeaScript](https://github.com/vihanb/TeaScript), ~~50~~ ~~45~~ 44 bytes
TeaScript is JavaScript for golfing.
```
`qwertyuiop
asdfghjkl
zxcvbnm`.s×[1]s(b)j(p)
```
### Ungolfed and explanation
```
`qwertyuiop
asdfghjkl
zxcvbnm`.s(x)[1]s(b)j(p)
      // Implicit: x = input string
`...` // Take the qwerty string,
.s(x) // and split it at the input.
[1]   // Take the second item from this,
s(b)  // split it into chars,
j(p)  // and join the result with spaces.
      // Implicit: output final expression
```
[Answer]
# JavaScript ES6, 73
```
f=x=>[...(k=`qwertyuiop
asdfghjkl
zxcvbnm`).slice(k.search(x)+1)].join` `
```
If a leading newline is not allowed when parameter is `p` or `l`, then **83**
```
f=x=>(k=`q w e r t y u i o p
a s d f g h j k l
z x c v b n m`).slice(k.search(x)+2)
```
[Answer]
# Sed, 59 characters
(58 characters code + 1 character command line option.)
```
s/./&qwertyuiop\nasdfghjkl\nzxcvbnm/
s/(.).*\1//
s/\w/& /g
```
Sample run:
```
bash-4.3$ echo -n 'f' | sed -r 's/./&qwertyuiop\nasdfghjkl\nzxcvbnm/;s/(.).*\1//;s/\w/& /g'
g h j k l 
z x c v b n m 
```
[Answer]
# Ruby, ~~86~~ ~~87~~ ~~83~~ ~~71~~ 66
```
puts"qwertyuiop
asdfghjkl
zxcvbnm ".split($*[0])[1].gsub /./,'\& '
```
The extra space after `m` is to prevent the program from crashing if the input is 'm'.
Thanks to @manatwork for ~16 bytes of tips
[Answer]
# PHP, 88 bytes
```
<?=$m[1&ereg("$argn.(.*)",'q w e r t y u i o p
a s d f g h j k l
z x c v b n m',$m)];
```
Requires the `-F` command line option, counted as 3. Default .ini setting are assumed (you may disable your local .ini with `-n`).
---
**Sample Usage**
```
$ echo g|php -F qwerty.php
h j k l
z x c v b n m
$ echo v|php -F qwerty.php
b n m
```
[Answer]
# Prolog (SWI), ~~153~~ 133 bytes
**Edit:** Cut 20 bytes with tips from @Fatalize
**Code**
```
b([A,_|T],[H]):-A=H,writef('%s',[T]);b(T,[H]).
p(X):-name(X,C),b(`q w e r t y u i o p \r\na s d f g h j k l \r\nz x c v b n m`,C),!.
```
**Explanation**
```
p(X):-name(X,C),                                                               % Get charcode of input
      b(`q w e r t y u i o p \r\na s d f g h j k l \r\nz x c v b n m`,C),!.    % Get keyboard chars as charcodes and call b
b([A,_|T],[H]):-A=H,                                                           % If list head is input element
                writef('%s',[T]);                                              % Interpret list as charcodes and print as string
                b(T,[H]).                                                      % Else remove first element of list and try again
```
**Examples**
```
>p(f).
g h j k l 
z x c v b n m
>p(q).
w e r t y u i o p 
a s d f g h j k l 
z x c v b n m
```
[Answer]
# Befunge, 122 bytes
```
"m n b v c x z"25*"l k j h g f d s a"v
v1-")"g2-"U"~"q w e r t y u i o p"*25<
>-:#v_$>:#,_@ZVD0FHJ:LNP^\<>,2B48X.T6R
^1$\<
```
It has been tested here: [Befunge-93 Interpreter](http://www.quirkster.com/iano/js/befunge.html).
### How it works
* `'q w e r t y u i o p\na s d f g h j k l\nz x c v b n m'` is pushed on the stack.
* The number of values to discard (hardcoded in `@ZVD0FHJ:LNP^\<>,2B48X.T6R`) N is pushed.
* First N values are discarded and the remaining values are printed.
### Note
I picked the encoding so the string starts with `@` in order to overlap with the program. This string is generated with the following python code:
```
import string
letters = string.ascii_lowercase
base = 'q w e r t y u i o p a s d f g h j k l z x c v b n m'
print(''.join(chr(base.index(x) + 32 + 9 + 3) for x in letters))
```
[Answer]
# [Japt](https://github.com/ETHproductions/Japt), ~~49~~ ~~42~~ ~~41~~ ~~40~~ 38 bytes
**Japt** is a shortened version of **Ja**vaScri**pt**. [Interpreter](https://codegolf.stackexchange.com/a/62685/42545)
```
`qØÆyuiop\n?dfghjkl\nzxcvbnm`qU g1 ¬qS
```
The `?` should be the unprintable Unicode char U+0086.
### How it works
```
          // Implicit: U = input char
`...`     // Take the compressed string and decompress it.
qU g1     // Split the string at the input and take the second item.
¬qS       // Split into chars, then join with spaces.
          // Implicit: output final expression
```
Now beating CJam! :) Suggestions welcome!
### Non-competing version, 12 bytes
```
;Dv qU g1 ¬¸
```
As of Jan 11, I've [added](https://github.com/ETHproductions/Japt/commit/0e43c90f2853308f4f7f7aca7759dd29a1eac1a5) a cool new feature to Japt: If the program contains a leading comma, the variables `ABCDEFGHIJL` are redefined to various values. `D` is set to `"QWERTYUIOP\nASDFGHJKL\nZXCVBNM"`, so `;Dv` is enough to replace the string here.
[Answer]
# Mumps - 102 Bytes
Golfed script:
```
S A="qwertyuiopasdfghjklzxcvbnm",B=0 R P F I=1:1:$L(A) S Q=$E(A,I) W:B Q," " X:"qpl"[Q "W !" S:Q=P B=1
```
Ungolfed and commented:
```
 S A="qwertyuiopasdfghjklzxcvbnm" ; Need the qwerty order
 S B=0 ; boolean flag for printing, default to false.
 R P   ; read from stdin into P
 F I=1:1:$L(A) D   ; Count I from 1 to length of qwerty variable; do all of the following:
 . S Q=$E(A,I)     ; Extract 1 letter (at position I) from A and save in Q.
 . W:B Q," "       ; If our print flag (B) is true, print the letter in Q & a space.
 . X:"qpl"[Q "W !" ; If Q is q, p or l, write a cr/lf
 . S:Q=P B=1       ; If Q == P (stdin) change our print flag from false to true.
```
The rule allowing extra newlines saved me almost 10 bytes...
[Answer]
# Java - 107 bytes
```
void q(char c){System.out.print("qwertyuiop\nasdfghjkl\nzxcvbnm ".split(""+c)[1].replaceAll("\\w","$0 "));}
```
Ungolfed with wrapper-class reading from System.in
```
public class Qwerty {
    public static void main(String[] args) {
        new Qwerty().q(new java.util.Scanner(System.in).next().charAt(0));
    }
    void q(char c) {
        System.out.print("qwertyuiop\nasdfghjkl\nzxcvbnm ".split(""+c)[1].replaceAll("\\w","$0 "));
    }
}
```
If spaces at *start-of-line* were acceptable, we could go down to 99 bytes:
```
void q(char c){System.out.print("qwertyuiop\nasdfghjkl\nzxcvbnm ".split(""+c)[1].replace(""," "));}
```
[Answer]
# 8086 machine code + DOS, 61 bytes
Hexdump (with ASCII view on the right):
```
B8 1E 01 8B F8 CD 21 B1 1F F2 AE 8B F7 AC 8A D0 ......!.........
B4 02 CD 21 80 E2 20 74 02 CD 21 E2 F0 C3 71 77 ...!.. t..!...qw
65 72 74 79 75 69 6F 70 0D 0A 61 73 64 66 67 68 ertyuiop..asdfgh
6A 6B 6C 0D 0A 7A 78 63 76 62 6E 6D 0D          jkl..zxcvbnm.
```
Assembly source code (can be assembled with tasm):
```
    .MODEL TINY
    .CODE
    org 100h
    MAIN PROC
    mov ax, offset qwerty ; sets ah=1 (coincidence)
    mov di, ax      ; di points to the string
    int 21h         ; reads a char from keyboard into al
    mov cl, 31      ; cx is the length of the string
    repne scasb     ; look for the char
    mov si, di      ; si now points beyond the found char
myloop:
    lodsb           ; load a char
    mov dl, al
    mov ah, 2
    int 21h         ; output the char
    and dl, 20h     ; if it's a letter, set it to a space
    jz print_done   ; if it's not a letter, don't print a space
    int 21h         ; if it's a letter, print a space
print_done:
    loop myloop     ; repeat until end of string
    ret
qwerty db 'qwertyuiop',13,10,'asdfghjkl',13,10,'zxcvbnm',13
    MAIN ENDP
    END MAIN
```
Two fun things here:
1. The offset of the `qwerty` string is `0x011e`. The upper byte of it is 1, which is the DOS function number for character input. This saves 1 byte in the code.
2. All lower-case letters have bit 5 set. When doing an `AND` with `0x20`, they are all turned into a space, which is then printed. If the previous char was an end-of-line byte, it gets turned into 0, and no space is output. This is used to avoid the nonsensical sequence `0d 20 0a 20` at end of line.
One almost-fun thing:
I tried to search for the input char starting at address 0 (that decreased program size by 2 bytes), instead of the usual place (start of the string). This almost worked; however, it failed for input `t`, because the code itself contains the byte `t` (as part of the encoding of a conditional jump). So for `t`, it would output a few junk bytes:
[![output](https://i.stack.imgur.com/2XE5U.png)](https://i.stack.imgur.com/2XE5U.png)
[Answer]
## Python 2, ~~58~~ ~~67~~ 63 bytes ##
```
lambda x:" ".join("qwertyuiop\nasdfghjkl\nzxcvbnm".split(x)[1])
```
Takes input as a string or char.
Splits the string at the input and prints off everything after the split.
(First time code-golfing, please be gentle :P )
EDIT: Didn't see the additional spaces required between characters, added now
EDIT 2: Modified to be an anonymous lambda function and removing the additional split arg, saving 4 bytes
[Answer]
#  Ruby, ~~59 57~~  67 bytes
Added spaces between letters
```
puts"qwertyuiop\nasdfghjkl\nzxcvbnm".split(gets.chop)[-1].chars*' '
```
[Answer]
# JavaScript, 88 bytes
```
function s(d){alert("qw e r t y u i o p\na s d f g h j k l\nz x c v b n m".split(d)[1])}
```
(no need in the space after the first char, as it never gets to the output)
Alerts the keyboard when you call `s("some letter")`. Can be also made with `document.write()` or `console.log()`, but hey, it's longer :P
Demo:
```
function s(d){alert("qw e r t y u i o p\na s d f g h j k l\nz x c v b n m".split(d)[1])}
s(prompt("Enter the key"));
```
[Answer]
**SQL (MS T-SQL), 172 bytes**
```
CREATE PROC c @I CHAR(1) AS DECLARE @S CHAR(49) SET @S = 'w e r t y u i o p' + CHAR(13) + 'a s d f g h j k l' + CHAR(13) + 'z x c v b n m' PRINT RIGHT(@S,LEN(@S)-CHARINDEX(@I,@S))
```
Ungolfed:
```
CREATE PROC c                           -- Create a procedure named "c"
    @I CHAR(1)                          -- Which is invoked with a single character input (@I)
AS
DECLARE @S CHAR(49) = 'w e r t y u i o p' + CHAR(13) + 'a s d f g h j k l' + CHAR(13) + 'z x c v b n m' -- Initialise the entire output omitting "q " as @S
PRINT RIGHT(@S,LEN(@S)-CHARINDEX(@I,@S))    -- Use the charindex funtion to effectively substring @S
```
I'm new here, only just discovered this site. No idea if I've posted correctly or if T-SQL is allowed but I know the procedure above works.
[Answer]
# O 2.2, ~~48~~ 46 characters
```
"qwertyuiop
asdfghjkl
zxcvbnm
"i/r;s{n.U=ST?}d
```
Sample run:
```
bash-4.3$ ./o keyboard.o <<< 'f'
g h j k l 
z x c v b n m 
```
## O, 61 characters
```
"qwertyuiop\nasdfghjkl\nzxcvbnm\n"i/r;""/rl{.o"\n"={}{' o}?}d
```
Sample run:
```
bash-4.3$ java xyz.jadonfowler.o.O keyboard.o <<< 'f'
g h j k l 
z x c v b n m 
```
[Answer]
# [Hassium](http://HassiumLang.com), 114 Bytes
```
func main(){k="qwertyuiop\nasdfghjkl\nzxcvbnm\n"foreach(l in k.substring(k.index(input())))print(l!="\n"?l+" ":l)}
```
Run online and see expanded with test case [here](http://HassiumLang.com/Hassium/index.php?code=f0fbf3d3e9709da3dfaa3c9942e80b22)
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-hR`](https://codegolf.meta.stackexchange.com/a/14339/), 12 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
;Dv qU ®·®¬¸
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWhS&code=O0R2IHFVIK63rqy4&input=InEi)
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~29~~ 35 bytes
*Edit +6 bytes when I realised that the letters need to be separated by spaces*
```
¶mJ' ¶!2x¨qw²yuiop₄sdfghjkl¶zxcvbnm
```
[Try it online!](https://tio.run/##yygtzv6f@6ip8f@hbble6gqHtikaVRxaUVh@aFNlaWZ@waOmluKUtPSMrOycQ9uqKpLLkvJy////H62epq6jXgjEuUCcox4LAA "Husk – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 38 bytes
```
↓2↓≠←⁰¶mJ' ¶¨qw²yuiop₄sdfghjkl¶zxcvbnm
```
[Try it online!](https://tio.run/##yygtzv7//1HbZCMgftS54FHbhEeNGw5ty/VSVzi07dCKwvJDmypLM/MLHjW1FKekpWdkZecc2lZVkVyWlJf7////dAA "Husk – Try It Online")
[Answer]
# JavaScript, 77 bytes
```
alert(`w e r t y u i o p
a s d f g h j k l
z x c v b n m`.split(prompt())[1])
```
### [Fiddle](https://jsfiddle.net/5bvf3jrm/)
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), 53 bytes
```
{` 0:1_*|x\"\n"/" "/'$$`qwertyuiop`asdfghjkl`zxcvbnm}
```
[Try it online!](https://tio.run/##y9bNS8/7/z/NqjpBwcDKMF6rpiJGKSZPSV9JQUlfXUUlobA8taiksjQzvyAhsTglLT0jKzsnoaoiuSwpL7f2f5qCUqHSfwA "K (ngn/k) – Try It Online")
Uses `"\n"/" "/'$$`...`...`...` to (slightly) compress `"q w e r t y u i o p\na s d f g h j k l\nz x c v b n m"`.
It then splits that string on the input character, taking the remainder that occurs after that character.
]