1009: Caesar Caesar Password time limit: ten Sec memory limit: MB
Submitted by: 349 resolution: 215
Submitted State [Discussion Version] Title Description
Julius Caesar lived in times of danger and intrigue. In order to survive, he invented the password for the first time for the army's message delivery. Suppose you are an officer in the Caesar Corps who needs to decipher the message sent by Caesar and provide it to your general. Message encryption means that each letter in the original message is replaced with the 5th letter of the letter (for example: Each letter A in the original message is replaced with the letter F), the other characters are unchanged, and all the letters in the original message are capitalized. 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 Original letter: 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
Input
Consists of up to 100 datasets. Each dataset consists of 3 parts: Start line: Start password message: A line consisting of 1 to 200 characters representing the end line of a message issued by Caesar: End after the last dataset, is another line: Endofinput
Output
Each data set corresponds to a row, which 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
Hint Source
2001289
#include <iostream>
#include <string.h>
using namespace std;
int main () {
string str = "Vwxyzabcdefghijklmnopqrstu";
string inputstr;
int i;
while (1) {
getline (CIN,INPUTSTR);
if (inputstr== "endofinput") break;
getline (CIN,INPUTSTR);
for (i=0;inputstr[i]!= '; i++) {
if (Inputstr[i] >= ' A ' &&inputstr[i]<= ' Z ') {
cout<<str[inputstr[i]-' a ' ];
}else{
cout<<inputstr[i];
}
}
cout<<endl;
getline (CIN,INPUTSTR);
}
return 0;
}
1009: Caesar Caesar Password