Description said the earliest cipher came from the Roman Emperor Julius Caesar. Message encryption means that each letter in the original of the message is replaced with the 5th letter after the letter (for example, each letter a in the original message is replaced with the letter F respectively). And you have to get the original message, which is to turn the process back.
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: 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 can be replaced, other non-alphanumeric characters will not be changed, and all letters in the original text of the message are capitalized.
Input is composed of no more than 100 datasets, no empty rows between each dataset, and 3 components per dataset:
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, is another row: Endofinput
Output each data set corresponds to a row, is Caesar's original message.
Sample Input
Start
ns BFW, jajsyx tk nrutwyfshj fwj ymj wjxzqy tk ywnanfq hfzxjx
end
START
N btzqi WFYMJW the NS F Qnyyqj ngjwnfs anqqflj Ymfs xjhtsi NS wtrj end START ifsljw pstbx kzqq bjqq ymfy hfjxfw
NX rtwj ifsljwtzx S MJ
End
Endofinput
Sample Output
In WAR, EVENTS of importance ARE The result of TRIVIAL causes I WOULD rather LITTLE to be-
A Iberian Village SECOND in ROME DANGER knows full so, CAESAR is more
dangerous THAN he
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main ()
{
int i;
string s1,s2;
Char s[200];
while (CIN>>S1)
{
if (s1== "Endofinput") break
;
GetChar ();
Cin.getline (s,200);
cin>>s2;
For (I=0;i<strlen (s); i++)
{
if (s[i]>= ' A ' &&s[i]<= ' Z ')
{
if (s[i]>= ' F ')
Cout<<char (s[i]-5);
else
Cout<<char (s[i]+21);
}
else
cout<<s[i];
}
cout<<endl;
}
return 0;
}