CC+ is a cyclical cypher. A cyclical cypher is a method of encrypting messages in which every letter in a message is "rotated" some number of positions. For example, if the letters are rotated a
becomes b
, b
becomes c
, and so on (z
becomes a
).
In a CC+ encryption (Cyclical Cypher Plus) the number of positions a given letter is rotated is based on an integer key value plus the sum of the letters to the right (where a
b
Before the letters get rotated, special encoding characters are added to the left of the message string. The first two characters represent the number of words in the message as a base a
b
af
, which converts to bc
, which converts to
Here's an example encoding using key
Message: | put the lime in the coconut |
---|---|
Step | agddecdh put the lime in the coconut |
Step | bbvspljgzkqxextiaokcpwpljvtfsy |
The input will contain
Note that the sample input below consists of only two test cases, but the data files will contain
Sample Input
5
put the lime in the coconut
13
ccxupnkiivspyqdtlsshwc
Sample Output
bbvspljgzkqxextiaokcpwpljvtfsy
and drink it all up
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
why does the output have spaces in it?