## DMOPC '14 Contest 5 P1 - New Key

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

PRIORITY ONE TRANSMISSION

• Union of Ecraxus

From: Agent Lore, Ecraxian Naval Intelligence, Section 2

Subject: New Key

Rumours are coming in from far sections of space that state the Hoyd aliens have deciphered our current system of coding for secret messages. Though this has not yet been confirmed, we have decided to play it safe and implement a new system.

In this new system, a letter is represented by something other than itself. Numbers represent letters (in order), letters represent the letters from , while the letters represent the letters .

To make it more difficult to decipher, in the decryption procedure, each character must then be shifted one to the left for the message to make sense. To decrypt 4 to D, 4 is changed to E, and then E is shifted to D. Important: when decrypting, the input 0 (encrypted) becomes 9 (decrypted). It was shifted one to the left from A.

We need you to make a key for this new code so that our agents will be able to communicate with one another.

#### Input Specification

The only line of input will contain the encrypted message. It will have a length of up to characters and will contain only digits and letters , uppercase only.

#### Output Specification

The only line of input should contain the decrypted message.

#### Sample Input

4DFG3

#### Sample Output

DMOPC

#### Explanation for Sample Input

The first character, 4 (0,1,2,3,4,5,6,7,8,9) becomes E (A,B,C,D,E,F,G,H,I,J). It is then shifted to the left by one to obtain D, the decrypted character.

• commented on Oct. 18, 2017, 5:22 p.m.

The first Test Case Does Not have an input?

• commented on Feb. 10, 2015, 4:38 p.m.

Is there no Z? And isn't 1(encrypted)=A(decrypted)? How do you get 9?

• commented on Feb. 10, 2015, 4:52 p.m.

You're right - 1 (encrypted) => A (decrypted). The problem statement says that 0 (encrypted) becomes 9 (decrypted). Also, you are correct again, there is no Z (not like anyone really uses it).

• commented on Feb. 10, 2015, 4:28 p.m.

We know that if we have 4, it will be read as D. So if we have 0, it will be read as 9???

• commented on Feb. 10, 2015, 4:29 p.m.

Never mind, just found out by submitting :)

• commented on Feb. 10, 2015, 4:32 p.m.

Yes - it was mentioned in the problem statement. Sorry for the confusion.

• commented on Feb. 10, 2015, 4:16 p.m.

Would it become z or j?

• commented on Feb. 10, 2015, 4:19 p.m.

"Important: when decrypting, the input 0 (encrypted) becomes 9 (decrypted). It was shifted one to the left from A."

So 0 becomes 9.

• commented on Feb. 10, 2015, 4:17 p.m.

The input 0 decrypts to the output 9.

• commented on Feb. 10, 2015, 4:19 p.m.

The entire alphabet (in step two) is shifted to the right such that the leftmost character is 9 and all of the remaining ones to the right of 9 are just ABCD...Y.

• commented on Feb. 10, 2015, 3:51 p.m.

If I'm reading the clarification correctly, A is mapped to 0, and then 0 is incremented for a final encryption of '1'.

• commented on Feb. 10, 2015, 3:59 p.m.

In the model solution, the correct decryption for A is J and for 0 is 9. Sorry for the inconvenience.

• commented on Feb. 10, 2015, 3:58 p.m.

No, 0 (encrypted) becomes A (decrypted). This is then shifted to the left to 9.