DMOPC '14 Contest 4 P1 - New Key

View as PDF

Submit solution


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

Author:
Problem type

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 09 represent letters AJ (in order), letters AJ represent the letters from KT, while the letters KP represent the letters UZ.

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 50 characters and will contain only digits 09 and letters AP, uppercase only.

Output Specification

The only line of input should contain the decrypted message.

Sample Input

4DFG3

Sample Output

DMOPC

Explanation for Sample Output

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.


Comments


  • -3
    rowanreader  commented on Feb. 10, 2015, 9:38 p.m.

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


    • -3
      Sentient  commented on Feb. 10, 2015, 9: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).


  • -3
    Oppenheimer  commented on Feb. 10, 2015, 9: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???


    • -3
      Oppenheimer  commented on Feb. 10, 2015, 9:29 p.m.

      Never mind, just found out by submitting :)


      • -2
        Sentient  commented on Feb. 10, 2015, 9:32 p.m.

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


  • 0
    msa789  commented on Feb. 10, 2015, 9:16 p.m.

    Would it become z or j?


    • 0
      Sentient  commented on Feb. 10, 2015, 9: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.


    • 2
      FatalEagle  commented on Feb. 10, 2015, 9:17 p.m.

      The input 0 decrypts to the output 9.


      • -1
        bobhob314  commented on Feb. 10, 2015, 9: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.


  • -2
    sigkill  commented on Feb. 10, 2015, 8: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'.


    • 0
      FatalEagle  commented on Feb. 10, 2015, 8:59 p.m.

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


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

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