Last active
December 24, 2015 22:59
-
-
Save ylogx/6876646 to your computer and use it in GitHub Desktop.
P3 - Decypher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* foobar - Shubham Chaudhary | |
* Nitul Datt | |
Alice and Bob are being held at Azkaban(Prison). They want to escape and join Dumbledore's Army. Alice wants to tell Bob about the details of the plan but wants to keep their escape plan from Dementors(the guards). So Alice encrypts the message before passing the chits to Bob's cell. However Bob was careless and he disposed the chits in his cell's waste paper bin. The clever Dementor found the chits but couldn't make out what they said. So he hired a computer programmer to decode the message for him. Please help the Dementor to decypher the message.The code key that Alice used for this simple coding is a one for one character substitution based upon a single arithmetic manipulation of the printable portion of the ASCII character set.INPUTThe Encrypted message in a single line. The maximum number of charaters in a message is 100. (DO NOT PRINT ANY PROMPT MESSAGE TO ENTER THE ENCRYPTED MESSAGE.)OUTPUTThe decrypted message in a single line. (Do not print any other message other than the decrypted message.)SAMPLE INPUT 1[YHUZMVYT'[V'HUPTHN\Z'MVYT3SAMPLE OUTPUT 1TRANSFORM TO ANIMAGUS FORM,SAMPLE INPUT 2HUK'LZJHWL'^OLU'[OL`'IYPUN'MVVK5SAMPLE OUTPUT 2AND ESCAPE WHEN THEY BRING FOOD. | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
/* | |
int fastread() | |
{ | |
unsigned int input; | |
char c=0; | |
while (c<33){ | |
c=getchar_unlocked(); | |
//printf("\nWHILE: c is %c",c); | |
} | |
input=0; | |
while (c>33) | |
{ | |
//printf("\nWHILE 2 : c is %c",c); | |
input=input*10+c-'0'; | |
//printf("\n%d * 10 + %d - %d",input,c,'0'); | |
c=getchar_unlocked(); | |
} | |
//printf("\nInput is : %d",input); | |
return input; | |
} | |
*/ | |
int main(){ | |
//foobar | |
char c; | |
c=getchar_unlocked(); | |
while(c!='\n'){ | |
printf("%c",c-7); | |
c=getchar_unlocked(); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment