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 code-golf 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
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