POJ3749 decipher the code.

Source: Internet
Author: User

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:

    1. Start line: Start
    2. Password message: A line consisting of 1 to 200 characters representing a message from Caesar.
    3. 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.

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.