Back
Close

Typo Cipher

Statement

 Goal

Mutahar makes a lot of typos. You're tasked to decrypt what he was originally trying to type.

Good thing is that his typos are very predictable. They follow these patterns -

1. All his letters are leftshifted on the keyboard if he ate a Taco before typing.
2. All his letters are rightshifted on the keyboard if he ate an Enchilada before typing.
3. The hour of the day is also going to determine by how many key(s) he is going to shift by. For example if it is 5PM, it is going to shift by 5 keys.
4. His typos only affect lowercase alphabets.

Note that typos rotate around the keyboard for a specific row. For example, if he's ate a Taco and he types an 'a' at 1AM, the result is going to be 'l'.
Input
Line 1: string
Line 2: food
Line 3: time

Muta uses a QWERTY keyboard. The keys look as follows from top to bottom row -

QWERTYUIOP
ASDFGHJKL
ZXCVBNM
Output
Line 1: [result string]
Constraints
0 < length(string) < 5000.
food = ('Taco', 'Enchilada').
3 <= length(time) <= 4.

string, food and time are of type string.
Example
Input
QeEtTu
Taco
11PM
Output
QwErTy

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
QeEtTu Taco 11PM
Output
QwErTy

Validator 1 Validator
Input
Gg8QlH47r7693DfrQ2XH Enchilada 10PM
Output
Gh8QaH47r7693DgrQ2XH

Test 2 Test
Input
pai ywebd moruz k0v Enchilada 5PM
Output
the quick brown f0x

Validator 2 Validator
Input
YsVqG7PhblQ5J89H53uTDTjr0tyDfScTgQCammDH Taco 9AM
Output
YsVwG7PhclQ5J89H53iTDTjt0yuDfSzTgQCabbDH

Test 3 Test
Input
Jrmul yvpq wfp Lkze ayd Taco 7AM
Output
Jumps over the Lazy dog

Validator 3 Validator
Input
YGoiFSgjHfQO11CbioTXrQVMPFE0Beno2MvmmjlP74SdX3HVQkfTfbfqxUIO Enchilada 8PM
Output
YGuyFSfhHdQO11CnyuTXwQVMPFE0Bqmu2MbzzhkP74SsX3HVQjdTdndocUIO

Test 4 Test
Input
icd I'mw dir ur! Enchilada 11AM
Output
omg I've got it!

Validator 4 Validator
Input
sp6Qg3AftQcRmcoMGfuUDB6agc6u5pNGzO6Dx8FXmjLuiDtwJ6uWL5UdnmvW1yVx1tWAb8yuIgzP3dre Taco 6AM
Output
gr6Qk3AjoQvRzveMGjqUDB6fkv6q5rNGxO6Dc8FXzaLqwDoyJ6qWL5UhmzbW1pVc1oWAn8pqIkxP3hiu

Test 5 Test
Input
50 hwddfug qg $50.00 Taco 3AM
Output
50 dollars is $50.00

Validator 5 Validator
Input
WI78QPOKA2oyktT1ZRqIG6Zmbt0QCIPNMCXpDn9lpMKyobOwzeS4C310MWRtu7dzdsJ7pFzuWt73O3YcEheOJnfPwbmYjgsjZjDv Enchilada 2PM
Output
WI78QPOKA2qiauT1ZReIG6Zxmu0QCIPNMCXwDz9swMKiqmOrctS4C310MWRuo7gcgfJ7wFcoWu73O3YbEktOJzhPrmxYljflZlDn

Solution language

Solution

Stub generator input