Back
Close

CaeXORian Shift

Statement
<<Caesarian Shift>> is an <<alphabet>> shift where you {{rot}}ate a character up/down based on its alphabetical order. Example, with a ROT(1) shift the letter {{a}} becomes {{b}}, {{b}} becomes {{c}} and so on. After {{z}} the letters start over from {{a}}, so with a ROT(5) shift {{x}} becomes {{c}}. <<XOR>> is a bitwise operation between two numbers which causes some bits to get flipped. It is symbolized by {{^}} in many coding languages. Your task is (1) take an input string [[myString]] (2) shift it up by the [[Key]] (3) substitute the numbers A=0, B=1, ... Z=25 (4) <<xor>> it with an [[XORKey]] making the same substitutions (5) convert back to letters (6) shift it down by the same [[Key]]. This will create a new string of text that is an encrypted version of the original text. If the [[XORKey]] provided is smaller than the string, then you go wrap around and start from the beginning, example: The [[string]] {{racer}} with the [[XORKey]] {{abc}} will actually need to XOR with {{abcab}} If there is a {{space}} in the string then keep it as it is, however the [[XORKey]] index still increments. Example: {{A B C}} with the <<xor>> {{abc}} would see <<B>> <<XOR>> with <<c>> and not with <<b>>, since <<B>> and <<c>> are both the 3rd character in the strings.

Input description
Line 1: A string [[myString]] to be encoded Line 2: The [[Key]] to shift with Line 3: The [[XORKey]] to encode with

Output description
A single line containing the encoded string in <<lowercase>>

Constraints
[[Key]]: 0 <= [[Key]] <= 255 [[myString]]: Contains only <<uppercase>> characters and {{space}} 1 <= Length <= 100 May <<start>> or <<end>> with a {{space}} [[XORKey]]: 1 <= Length <= 100 Is all <<lowercase>> characters

Game modes

Test cases
Coding Game Test
Input
CODINGAME 12 thethiny
Output
rvzvsopor

Validator 1 Validator
Input
CXDINGAME 12 thethiny
Output
rczvsopor

Anger Test
Input
I HATE MY CAT 1 abcd
Output
i jbtd ny abt

Validator 2 Validator
Input
I HAT MY CAT 1 abcd
Output
i jbt oz bcw

Happy Ending Test
Input
I NLVD NY ABT 1 abcd
Output
i love my cat

Validator 3 Validator
Input
I HAT MY CAT 1 abcd
Output
i jbt oz bcw

A Ghost??? Test
Input
AAAAAAAAAAAA 26 boo
Output
booboobooboo

Validator 4 Validator
Input
AAAAAAAAAAAA 26 cat
Output
catcatcatcat

SCREAM! Test
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ 0 abcdefghijklmnopqrstuvwxyz
Output
aaaaaaaaaaaaaaaaaaaaaaaaaa

Validator 5 Validator
Input
ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 abcdefghijklmnopqrstuvwxyz
Output
acagacaoacagacaeacagacaoay

Time To Sleep Test
Input
ABBAAB 0 zyyzzy
Output
zzzzzz

Validator 6 Validator
Input
ABABAB 0 zyyzzy
Output
zzyyzz

Deja Vu Test
Input
THIS SHOULD BE THE SAME 104 a
Output
this should be the same

Validator 7 Validator
Input
MY STRING 104 a
Output
my string

SPAAAAAAAAAAAACE Test
Input
SPACE IS FUN 6 uvraysaretoxic
Output
qwiey ef uuf

Validator 8 Validator
Input
SPACE IS FUN 12 uvraysaretoxic
Output
yksas el oup

Zoo Test
Input
ZEBRA 1 animal
Output
zhjda

Validator 9 Validator
Input
ZEBRA 1 aaimal
Output
zejda

This is a very long title Test
Input
THIS IS A VERY LONG STRING THAT CONSISTS OF JUST BELOW ONE HUNDRED CHARACTERS AND CONTAINS SPACES 47 xorkey
Output
erxm gf j zggi rsvb hjngku jlse lirazikm wc akob dnrso mey fdlolif eyknsffnlo hlo ywkfjora igkygf

Validator 10 Validator
Input
THIS IS A VERY LONG STRING THAT CONSISTS OF JUST BELOW ONE HUNDRED CHARACTERS AND CONTAINS SPACES 255 xorkey
Output
erxm gf j zggi rsvb hjngku jlse lirazikm wc akob dnrso mey fdlolif eyknsffnlo hlo ywkfjora igkygf

Solution language

Solution

Stub generator input