Decryption
Statement
The goal is to decrypt an incoming message.
For this purpose you are given a message [[msg]] containing characters ranging from 32 to 126 in ascii values, as well as an [[offset]].
To decrypt a message, the ascii value of each character must be shifted by <<+>>[[offset]] when in an <<even>> index position, <<->>[[offset]] when <<odd>>.
Should the ascii value go out of range (<32 or >126), it can be brought back within range by adding or substracting <<95>> as many times as needed.
<<Example>>
[[msg]] = "{{uf}}"
[[offset]] = {{90}}
convert {{u}} to ASCII: <<117>>
index of u == 0 == <<even>> number
117 - 90 == <<27>>
27 < 32: <<out of range>>
27 + 95 == <<122>>
122 to char == <<z>>
convert f: <<102>>
index is 1 == <<odd>>
102 + 90 == <<192>>
192 > 126: <<out of range>>
192 - 95 == <<97>>
97 to char == <<a>>
result == {{za}}
Input description
<<Line 1:>> A string [[msg]] that is to be decrypted.
<<Line 2:>> A string that <<if valid>> is an integer [[offset]] to represent how much an ASCII number should be shifted.
Output description
The resulting decrypted string message or "{{ERROR}}"
Constraints
[[msg]] only contains ASCII between values <<32>> and <<126>> (inclusive)
0 < [[offset]]
Game modes
Test cases
Simple Test Test
Input
Ugvcmq{Y}j}k(Av[weqfo
8
Output
Monkeysaurus Incoming
Validator 1 Validator
Input
[lm_tn&Lkmvitmk
6
Output
Urgent Response
Large Offset Test
Input
196K==;W*;;G+9=A,K
40
Output
hamster acrobatics
Validator 2 Validator
Input
0:5L<>:X;P1G/B6@
39
Output
hamster swinging
Invalid Input Test
Input
fAGddf3^£&
[]
Output
ERROR
Validator 3 Validator
Input
Different validator test
[]
Output
ERROR
Invalid Input 2 Test
Input
Employ sticky boot tactics
0
Output
ERROR
Validator 4 Validator
Input
Validator 7
0
Output
ERROR
Massive Offset Test
Input
=<8;IK2<IC+J/IID9E5<CJJ
1466
Output
send the laser monkeys!
Validator 5 Validator
Input
(F/J.d)T*P!^;R|^$J)
1452
Output
laser monkey mayhem
Solution language
Solution
Stub generator input