The Challenge:
Given any input that can be typed on a keyboard, move the text along by N chars.
Here is the QWERTY keyboard to be used. You can ignore the modifier keys (Shift, Caps, Enter, Delete and Tab). Once you reach one side (for example |
) loop back round, so |
goes to Q
if N = 1
.
Spaces do not have to be moved along (they go back round to space as you skip modifiers). If shift was used to type the character (e.g. !
and @
) the changed character should also be typed using shift (i.e. !
goes to @
not 2
if N = 1
).
UK keyboards are different to this, but please use this so that we can compare.
Input:
Any sentence that can be typed on the above keyboard followed by a positive integer. There is no maximum to the size of this integer.
Output:
The same sentence, shifted along by N.
Examples:
My name is Tim 3
?o .f/y [g I[/
Hello World 7
Spgge Oe[g;
I Wi5h I h4d b3773r C@d3ing ski{{s 3
{ T[8l { l7h ,6006u N%h6[.k g'[QQg
This is code golf, so shortest code wins.
N<= 13
as you will need to shift at most 13 in order to return to the original character? \$\endgroup\$Hello World 7
example beSpgge Oe[g;
? The twoo
should map to the same character \$\endgroup\$