# Left Hand vs. Right Hand — Typists Challenge

Your task is to pit each side of the keyboard against each other and build two programs, in the same language, one using only keys on the left-hand side of a standard keyboard that outputs Pollinium milk; plump pumpkin; lollipop?, and one using the keys on the right that outputs Weatherheaded sweetheart haberdasheress!.

## Rules

The exact keys allowed for the left-hand program are:

123456!@#$%^QWERTYqwertyasdfghASDFGHzxcvb~ZXCVB  and for the right-hand program: 7890-=&*()_+uiop[]UIOP{}jkl;'\JKL:"|nm,./NM<>?  There are four free keys Esc (\x1b), Tab (\x09), Space (\x20) and Enter(\x0a and/or \x0d) which can be used in either, neither, or both solutions. Your score will be the total byte count for both programs. Whilst I've used the term program, your submissions can either be full programs, or functions as usual, and both can be different types (eg. one full program, and one function). Your result must include the desired text, any amount of leading and trailing whitespace is fine, as long as the exact text appears within it. The shortest solutions in each language win. • Why H is left hand? – tsh Mar 9, 2018 at 5:52 • @tsh I wanted to split the keyboard 6/6 (or as close to that as possible) just to try and keep more even number of symbols for each "hand". Mar 9, 2018 at 5:56 • // Maybe i should learn whitespace and back later... – tsh Mar 9, 2018 at 6:16 • @tsh, I guess a whitespace answer is inevitable! Not sure how competitive it would be though! Perhaps I should have addressed that, too late now! Mar 9, 2018 at 6:25 • Is it OK if the program has other (non-whitespace) output too, as long as it includes the requested texts? Mar 9, 2018 at 12:12 ## 5 Answers # Perl 5, 261 = 88 + 173 bytes This is an example where "language options don't count" is a problem. The rigt side solution uses -p, the left side doesn't. So does it count as the same language or not? And should the options come from the left/right character set ? # Left 88 use -M5.10.0 (or -E from the commandline) to activate say Again arguable if this option should count as code and should come from the left side or if it falls under "options to set language version don't count" say eYYYYZYEYWYYYYYWQYEYQWQEYQYYZYWYYYYYQYQW^q%565504004w4052bw!504!w!04!204bw56550!6!h%  Try it online! # Right 173 Run with the -p option (which also consists of right characters) }{*_=\(uuuuuuuuuuuuuiuuuuuuuuuuiuuuuuuuuuuuuuui&Uiipjipjiijij0puiipjiipp0jijipjipjipipp7|Ouiujujjuiuuu0kouuujuiju0jijujuikjujukk7&"7oulio7iouloli77ooliou7liiu7o7lu7io7o77i")  This can almost certainly be improved, but for now it was hard enough to get something working. Not having access to print, say, $_ and sub{} makes output tricky

Try it online!

• Not concerned about flags at all, I'm happy that this is valid. A much shorter solution than what I've been tinkering with as I called eval via &{(u&I.._)[9-7].O.(P|'"'&_).("U::u"&"o::o").("&"|p).(uo&il).(u&i.._)[9-8].("{|o"&"}uu").(j..u)[9]}! Mar 9, 2018 at 9:32

# Whitespace, 11751143655645638632639 578 (293 + 285) bytes

It had to be done.. ;p
Can definitely be golfed by filling the stack reversed and printing it all at the end in some kind of loop, but this is only my second Whitespace program ever, so I've yet to figure it out.. EDIT: Golfed.

+7 bytes because I misspelled pumpkin as pumkin.. (Thanks for noticing, @fəˈnɛtɪk.)

Letters S (space), T (tab) and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Left-sided Pollinium milk; plump pumpkin; lollipop?:

[S S T  T   S T T   T   T   N
_Push_-47_?][S S S T    S N
_Push_2_p][S S S T  N
_Push_1_o][S T  S S T   N
_Copy_1st_p][S S T  T   S T N
_Push_-5_i][S S T   T   S N
_Push_-2_l][S N
S _Duplicate_-2_l][S S S T  N
_Push_1_o][S T  S S T   N
_Copy_1st_l][S S T  T   S S T   T   T   S N
_Push_-78_space][S S T  T   T   S S T   T   N
_Push_-51_;][S S S N
_Push_0_n][S S T    T   S T N
_Push_-5_i][S S T   T   T   N
_Push_-3_k][S S S T S N
_Push_2_p][S S T    T   N
_Push_-1_m][S S S T T   T   N
_Push_7_u][S S S T  S N
_Push_2_p][S S T    T   S S T   T   T   S N
_Push_-78_space][S S S T    S N
_Push_2_p][S S T    T   N
_Push_-1_m][S S S T T   T   N
_Push_7_u][S S T    T   S N
_Push_-2_l][S S S T S N
_Push_2_p][S S T    T   S S T   T   T   S N
_Push_-78_space][S S T  T   T   S S T   T   N
_Push_-51_;][S S T  T   T   N
_Push_-3_k][S S T   T   S N
_Push_-2_l][S S T   T   S T N
_Push_-5_i][S S T   T   N
_Push_-1_m][S S T   T   S S T   T   T   S N
_Push_-78_space][S S T  T   N
_Push_-1_m][S S S T T   T   N
_Push_7_u][S S T    T   S T N
_Push_-5_i][S S S N
_Push_0_n][S S T    T   S T N
_Push_-5_i][S S T   T   S N
_Push_-2_l][S N
S _Duplicate_-2_l][S S S T  N
_Push_1_o][S S T    T   T   T   T   S N
_Push_-30_P][N
S S N
_Create_Label_LOOP][S S S T T   S T T   T   S N
_Push_110][T    S S S _Add][T   N
S S _Print_as_char][N
S N
N
_Jump_to_Label_LOOP]


Try it online (with raw spaces, tabs and new-lines only).

Right-sided Weatherheaded sweetheart haberdasheress!:

[S S T  T   S S S T S S N
_Push_-68_!][S S S T    T   T   S N
_Push_14_s][S N
S _Duplicate_14_s][S S S N
_Push_0_e][S S S T  T   S T N
_Push_13_r][S S S N
_Push_0_e][S S S T  T   N
_Push_3_h][S S S T  T   T   S N
_Push_14_s][S S T   T   S S N
_Push_-4_a][S S T   T   N
_Push_-1_d][S S S T T   S T N
_Push_13_r][S S S N
_Push_0_e][S S T    T   T   N
_Push_-3_b][S S T   T   S S N
_Push_-4_a][S S S T T   N
_Push_3_h][S S T    T   S S S T S T N
_Push_-69_space][S S S T    T   T   T   N
_Push_15_t][S S S T T   S T N
_Push_13_r][S S T   T   S S N
_Push_-4_a][S S S N
_Push_0_e][S S S T  T   N
_Push_3_h][S S S T  T   T   T   N
_Push_15_t][S S S N
_Push_0_e][S N
S _Duplicate_0_e][S S S T   S S T   S N
_Push_18_w][S S S T T   T   S N
_Push_14_s][S S T   T   S S S T S T N
_Push_-69_space][S S T  T   N
_Push_-1_d][S S S N
_Push_0_e][S S T    T   N
_Push_-1_d][S S T   T   S S N
_Push_-4_a][S S S N
_Push_0_e][S S S T  T   N
_Push_3_h][S S S T  T   S T N
_Push_13_r][S S S N
_Push_0_e][S S S T  T   N
_Push_3_h][S S S T  T   T   T   N
_Push_15_t][S S T   T   S S N
_Push_-4_a][S S S N
_Push_0_e][S S T    T   T   T   S N
_Push_-14_W][N
S S N
_Create_Label_LOOP][S S S T T   S S T   S T N
_Push_101][T    S S S _Add][T   N
S S _Print_as_char][N
S N
N
_Jump_to_Label_LOOP]


Try it online (with raw spaces, tabs and new-lines only).

Explanation:

It first build the stack reversed. Pushing a number is done as follows:

• S at the start: Enable Stack Manipulation
• S: Push what follows as number to the stack
• S/T: Sign bit where S is positive and T is negative
• Some T and S followed by an N: Put number as binary to the stack (T=1 and S=0).

Then it will loop over the stack reversed and print everything as characters. It does this as follows:

1. Push 0 (SSSN)
2. Push all numbers indicating the characters reversed as explained above
3. Create a Label_0 (NSSN)
1. Duplicate the top of the stack (SNS)
2. If this value is 0: Jump to Label_1 (NTSTN)
3. Else: Pop and print the top of the stack as character (TNSS)
4. Jump to Label_0 (NSNN)
4. Create Label_1 (NSSTN)

This above is the default layout for both programs. Here is the change-log for this default layout which lowered the byte-count even further:

1. All numbers are lowered by the same amount (100 110 in the first program, and 102 101 in the second) to decrease the binary digits used for the now lower numbers, and between step 3.2 and 3.3 the following two sub-steps are added:

• Push 110 (SSSTTSTTTSN) in program 1, or 101 (SSSTTSSTSTN) in program 2
• Pop and add the top two values of the stack with each other, and the result is the new top of the stack (TSSS)
2. I've also used SNS in some cases to duplicate the top of the stack, which is used to golf the ll, ll, ee and ss.

3. In addition, step 4 (create Label_1) was removed completely. It will exit with an error, but will still output everything correctly (which is allowed according to the meta).

4. It's possible to copy an n'th value from the top of the stack (with STS + 0-indexed n), which is shorter than creating a new number in some cases.
In the first program I've done this for: the second p in pop (STSSTN (copy 1st) is shorter than SSSTTSSN (create number for 'p')), the second l in lol (STSSTN (copy 1st) is shorter than SSSTSSSN (create number for 'l')), the second p in p p (STSSTN (copy 1st) is shorter than SSSTTSSN (create number for 'p')), the second p in pumlp (STSSTTN (copy 3rd) is shorter than SSSTTSSN (create number for 'p')), the second p in pmup (STSSTSN (copy 2nd) is shorter than SSSTTSSN (create number for 'p')), the second m in m m (STSSTN (copy 1st) is shorter than SSSTSSTN (create number for 'm')), the second i in ini (STSSTN (copy 1st) is shorter than SSSTSTN (create number for 'i')).
In the second program this isn't done for any. The distance between some is pretty short, like ere or ded, but creating the number for 'e' (SSTTN) or 'd' (SSTTSN) are both shorter or of equal length as copy 1st (STSSTN), so I couldn't apply this trick in the second program to save bytes. NOTE: After golf-step 7, not all of these apply anymore.

5. In both programs I've changed step 1 of the loop from SSSN (Push 0) to SSN (Push error_value), and removed the steps 3.1 (SNS Duplicate) and 3.2 (NTSTN If 0: Exit). Now it will simply exit with an error that SSN is an unknown value as soon as it's tries to access it.

6. Removed the SSN(error_value) completely in both programs. It will now stop with the error "Can't do Infix Plus" when it tries to do the Add-function with nothing left on the stack.

7. Changed the constant values of 100 and 102 to 110 and 101 respectively. Here the Java program used to generate the 110 constant; and here the Java program used to generate the 101 constant. Note that there are now less Copy used than described at point 4 above, because the new values are in many cases shorter than the copies, so re-pushing them is shorter.

• The ST stuff is just push the number as binary, with space as 0, tab as 1. Output is the TNSS, so you have an extra two spaces at the beginning of each program. It also probably save bytes to duplicate and then add/subtract for each character and loop over the values at the end.
– Jo King
Mar 9, 2018 at 11:24
• You misspelt pumpkin. Jun 5, 2018 at 11:46
• @fəˈnɛtɪk Whoops lol.. Should be fixed now, thanks for noticing. Jun 5, 2018 at 11:58

# Lenguage, this many bytes

The left-hand side is 65721878296123796350462639500449228197646164622176218219262161264085219054330862921130017235140285847450697804123168755463678390611789188813352602373675420824698785508893489685489807676509031860196742608788337382365939621331808044899882497347443262020486908162559376082705672994569868 repetitions of the a character, which is equivalent to the following Brainfuck program:

-[--->+<]>-----.[--->+<]>-.---..---.+++++.-----.++++++++++++.--------.[->+++++<]>-.+[----->+<]>.----.+++.-.--[->+++<]>.+[-->+<]>++.[-->+++++++<]>.----.+++++++++.--------.+++.[------->++<]>.[-->+++++++<]>.+++++.--------.+++.-----.--.+++++.[-->+<]>++++.+[-->+<]>++.++[--->++<]>.+++.---..---.+++++++.-.+.[--->++++<]>-.


Try it online!

The right-hand side is 636605880289050800007960838028215177632402180834140124157618258152393860687206680356620669530585999501769442445842690365640523699585001167392310123764258380235064746704898152544431842440556280249638840374132783257375880144623575829131522611446544303839106505176776161206935275549421170646618266717893044911373119804737614528140 repetitions of the p character, which is equivalent to the following Brainfuck program:

+[--->++<]>+.++[->++++<]>+.----.--[--->+<]>-.------------.---.+++++++++++++.----------.---.----.+++.+.-.-[--->+<]>-.---[->++++<]>-.++++.[->+++<]>..[--->+<]>---.------------.---.----.--[--->+<]>---.++.[---->+<]>+++.-[--->++<]>--.-------.+.+++.+++++++++++++.--------------.---.--[--->+<]>--.-----------.---.+++++++++++++.-------------.[--->+<]>----..+[-->+++++<]>-.


Try it online!

# CJam, 128 + 192 = 320 bytes

64G^c111c111Z^cT$111c6^111X^c1$116X^c111Y^c32c1$6$Y3#$111c4^56Z^c32c112c13$A$A$3$5$1$4$4$4$12$22$22$14$32c13$111c1$T$7$A$4$1$63c  Try it online! 'U))'i(((('_))'u('i('i(((('p))'i('i(((('_))'_)))))'i(((('_)))))'&(((((('u(('u))'i(((('i(((('u('i('i(((('_))'p))'u('&(((((('i('_))'_)))'i(((('p))'_)))))'_))'u(('i('i(((('p))'i(((('u(('u(('&(((((  Try it online! # Fission, 958 + 752 = 1710 bytes ._. ### Left D z ^@$$@!@$$$@!@~~~@!!@~~~@!@$@!@~~~~~@!@@!@~~~~~~~~@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@$@!@~~~~@!@$$@!@~@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@$$$$@!@~~~~@!@$$$$@!@~~~~~~~~@!@$$$@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@@!@$@!@~~~~~~~~@!@$$@!@~~~~~@!@~~@!@$$$$@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~@!@$$$$@!@$$$@!@~~~@!!@~~~@!@$@!@~@!@$@!@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@!V  Try it online! ### Right  } \} \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \} \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ } \ O________________________________________I'/O\/O\__u'/O\____i'/O\++p'/O\___/O\_i'/O\__u'/O\___/O\_____i'/O\++p'/O\+++/O\+/O\_______/O\_i'/O\_________________________________________I'/O\_u'/O\++p'/O\____/O\___/O\_i'/O\_u'/O\/O\____i'/O\++u'/O\__u'/O\_________________________________________I'/O\_/O\+/O\+++/O\____/O\___/O\_i'/O\++p'/O\___/O\_i'/O\_u'/O\____/O\____i'/O\+++++++P'L  Try it online! OK, here we are with plain luck, actually ._. First cool feature of Fission is that it has 4 commands to create command pointers, AKA atoms: RLDU, so I have two commands for left and right groups. Second lucky charm is 2 commands for output ! and O, which occurs in different groups. Third time the charm. Both outputting comands output ASCII equivalent of atoms' mass. So I need to change it some how. Lucky me! Both + (+1 mass) and _ (-1 mass) are in one group and all needed three $ (+1 energy), ~ (-1 energy), @ (swap mass and energy) are in other group.

Also there are mirrors to control atoms in both groups! But I didn't use them in first program

So there is nothing to stop me, but it can't be compact, setting masses step-by-step.

### First program

First program consists of only Dz^@\$~!V

D   create atom, going down
z   set its mass to ASCII code of 'z'
^   split atom in 2, dividing their mass. One goes left, second - right


Start can be simplier (just R), but using divide saves some bytes for first letter.
Atom, that goes left wraps around and encounters V, which makes him going down and wrapping indefinitely, doing nothing.
Second atom goes rigth and will encounter bunch of repeated patterns @...@! for each letter to output.

@   swap atom's mass and energy
... increament or decrement energy until it would match desired ASCII code
@   swap again
!   print character by atoms mass


Eventually it will encounter V and share fate of first atom. There is no way to destroy them or halt with left part of keyboard.

### Second program

Second comes with its ups and downs. I've got comands to change mass directly, but output command O destroys atoms, so I need to preserve them somehow.
Program starts on the right from L with atom going left.

Repeated pattern:

} \
/O\...X'


' puts next encoutered char's ASCII code in atoms' mass, so code of some X is stored first, than mass is changed by _ and + to exact value.
Sometimes X' is skipped, if it is shorter to use just _ and +.

Atom comes from the left, mirrors two times and hits } from left. In this case } works like cloner, sending two identical atoms up and down. Down atom reflects by mirror and goes left. Up atom wraps, hits same mirror but from below and so reflects right, encountering O and printing.
At the end last atom meets final O` to be destructed.