Wrong keyboard position

5

You are in fact writing an interpreter for the language "Wrong keyboard position". You can pretend that you are not doing this and just follow the instructions below.


I typr re;atively accuratrly, but so,etimes I made a whole nlock of text illegible by shifting a key right. So I need a program that corrects my text back to its original meaning.

Rules

  • You have to left shift on a standard English QWERTY keyboard.
  • Whitespace do not count for the procedure before left-shifting and are kept as-is in a standard left-shifting procedure. If the key is the leftmost letter/symbol on a keyboard(i.e. The ~key, Q key, A key, Z key.), the key is kept as-is. If you reach a control character while left-shifting (Caps lock and Shift), their effects will not be triggered and the character before left-shifting is kept.
  • This is a contest; the shortest answer wins.
  • Both the input and the output shall be given via our default methods.

Representation of a subset of the QWERTY keyboard that you will need

The two lines connected are possible values of the key: shifted/unshifted.

~!@#$%^&*()_+
`1234567890-=

QWERTYUIOP{}|
qwertyuiop[]\

ASDFGHJKL:"
asdfghjkl;'

ZXCVBNM<>?
zxcvbnm,./

(Space)
(Space)

Input

The input will always be a non-empty string conforming the rules above.

Output

The output will be the input string corrected to the originally intended meaning.

Examples:

Yjod ,sfr yjr, imjsppu/ -> This made them unhaooy.
vpfr hp;g -> code golf

user85052

Posted 2019-09-10T11:04:05.477

Reputation:

Question was closed 2019-09-10T11:20:58.070

1Test case fixed. – None – 2019-09-10T11:19:06.720

I ported my solution with almost no change, so I'm gonna agree with the duplicate vote.

– Grimmy – 2019-09-10T12:59:26.227

Answers

2

05AB1E, 59 bytes

-1 byte thanks to Kevin Cruijssen

žVDu«1ú`žhÀ“~!@#$%^&*()_+ `ÿ-=ÿ<>?ÿ:"ÿ{}|ÿ,./ÿ;'ÿ[]\“#vy¦y‡

Try it online!

Grimmy

Posted 2019-09-10T11:04:05.477

Reputation: 12 521

1

-1 using žhÀ instead of 9LJ, so the 0 inside the string can be removed (same applies to your other answer)

– Kevin Cruijssen – 2019-09-11T06:19:51.863

@KevinCruijssen updated both, thanks! – Grimmy – 2019-09-11T10:17:50.170