Description
Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ciphers. This cipher is so incredibly sound, and that's no one could figure it out without knowing how it worked. You are a sub captain of Caesar ' s army. It is your job to decipher the messages sent by Caesar and provide to your general. The code is simple. For each of the plaintext message, you shift it five places to the right to create the secure message (i.e., if the L Etter is ' A ', the cipher text would was ' F '). Since you is creating plain text out of Caesar ' s messages, you'll do the opposite:
Cipher text A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Plain text V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
Only letters is shifted in this cipher. Any non-alphabetical character should remain the same, and all alphabetical characters would be a upper case.
Input
Input to this problem would consist of a (Non-empty) series of up to data sets. Each data set is formatted according to the following description, and there would be no blank lines separating data s Ets. All characters would be uppercase.
A Single Data set have 3 components:
Start Line-a single line, "Start"
Cipher message-a single line containing from one to the other hundred characters, inclusive, comprising A single message from Caesar
End Line-a single line, "End"
Following the final data set would be a, "endofinput".
Output
For each data set, there'll is exactly one line of output. The original message by Caesar.
Sample Input
Startns BFW, Jajsyx tk nrutwyfshj fwj ymj wjxzqy tk ywnanfq hfzxjxendstartn btzqi wfymjw GJ knwxy NS F qnyyqj NGJWNFS ANQQ Flj Ymfs xjhtsi NS wtrjendstartifsljw pstbx kzqq bjqq ymfy hfjxfw NX rtwj ifsljwtzx Ymfs mjendendofinput
Sample Output
In WAR, EVENTS of importance is the RESULT of TRIVIAL Causesi would rather be first in A LITTLE Iberian VILLAGE THAN SECO ND in Romedanger KNOWS full well, CAESAR is more dangerous THAN HE
#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespacestd;intMain () {#ifdef cdzsc_offline freopen ("In.txt","R", stdin);#endif Charstr[ the],s[1024x768]; Chara[ -]="Vwxyzabcdefghijklmnopqrstu"; intLen,i; while(SCANF ("%s", str)) { if(strcmp (str,"Endofinput")==0) { Break; } getchar (); Cin.getline (s),1024x768); scanf ("%s", str); Len=strlen (s); for(i=0; i<len; i++) { if(s[i]>='A'&&s[i]<='Z') {printf ("%c", a[s[i]-'A']); } Else{printf ("%c", S[i]); }} printf ("\ n"); } return 0;}
View Code
Cdzsc_2015 new Winter Holiday (1)--Basic E