Description
It is said that the earliest password came from the emperor Julius Caesar of Rome. Message encryption is done by replacing each letter in the original message with the 5th letter of the letter (for example: Each letter A in the original message is replaced with the letter F). And you want to get the message in the original, which is to reverse the process.
Password Letter: 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 M
Original text mother: 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
Note: Only letters are replaced, other non-alphabetic characters are not changed, and all letters in the original message are capitalized.
Input
No more than 100 datasets, no blank rows between each dataset, and each dataset consists of 3 parts:
- Start line: Start
- Password message: A line consisting of 1 to 200 characters representing a message from Caesar.
- Ending line: End
After the last dataset, there is another line: Endofinput
Output
One row for each dataset is the original message of 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
Positive Solutions: Simulation
Problem Solving Report:
Nothing to do brush point water problem ... Direct simulation will do.
1#include <iostream>2#include <cstdio>3#include <cmath>4#include <cstring>5#include <cstdlib>6#include <algorithm>7#include <vector>8 using namespacestd;9 Const intMAXN = .;Ten CharCH[MAXN]; One AInlineintGetint () { - CharC=getchar ();intw=0, q=0; - while(c!='-'&& (c<'0'|| C>'9')) c=GetChar (); the if(c=='-') C=getchar (), q=1; - while(c>='0'&& c<='9') w=w*Ten+c-'0', c=GetChar (); - returnq?-w:w; - } + -Inlinevoidsolve () { + while(1){ Ascanf"%s", ch); at if(ch[0]=='E') Break; - //scanf ("%s", ch); - //int L=strlen (CH); - CharC=GetChar (); - intl=-1; - Do{ inC=GetChar (); -ch[++l]=C; to if(c=='\ n') Break; +} while(1); - for(intI=0; i<l;i++) { the if(ch[i]>='A'&& ch[i]<='Z') { *ch[i]=ch[i]-5; $ if(ch[i]<'A') ch[i]+= -;Panax Notoginseng } - } the for(intI=0; i<l;i++) printf ("%c", Ch[i]); +printf"\ n"); Ascanf"%s", ch); the } + } - $ intMain () $ { - solve (); - return 0; the}
POJ3749 decipher the code.