1009: Caesar Caesar Password

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.