ZSC_ Winter Training 5

Source: Internet
Author: User
Tags strcmp

Description

Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ciphers. This cipher is so incredibly sound, and that's no one could figure it out without knowing how it worked.
You are a sub captain of Caesar ' s army. It is your job to decipher the messages sent by Caesar and provide to your general. The code is simple. For each of the plaintext message, you shift it five places to the right to create the secure message (i.e., if the L Etter is ' A ', the cipher text would was ' F '). Since you is creating plain text out of Caesar ' s messages, you'll do the opposite:

Cipher text
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

Plain 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

Only letters is shifted in this cipher. Any non-alphabetical character should remain the same, and all alphabetical characters would be a upper case.

Input

Input to this problem would consist of a (Non-empty) series of up to data sets. Each data set is formatted according to the following description, and there would be no blank lines separating data s Ets. All characters would be uppercase.

A Single Data set have 3 components:

Start Line-a single line, "Start"

Cipher message-a single line containing from one to the other hundred characters, inclusive, comprising A single message from Caesar

End Line-a single line, "End"

Following the final data set would be a, "endofinput".

Output

For each data set, there'll is exactly one line of output. The original message by 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
1#include <iostream>2#include <cstring>3#include <cstdio>4#include <algorithm>5 using namespacestd;6 intMain ()7 {8 #ifdef Cdzsc_offline9Freopen ("In.txt","R", stdin);TenFreopen ("OUT.txt","W", stdout); One #endif A     Charb[]="Vwxyzabcdefghijklmnopqrstu"; -     Char*a[]={"START","END","Endofinput"}; -     Chars[ the],x[ -]; the      while(SCANF ("%s", s)) -     { - GetChar (); -         if(strcmp (a[0],s) = =0) +         { -              while(gets (x)) +             { A                 if(strcmp (a[1],x) = =0) at                 { -                      Break; -                 } -                 Else -                 { -                     intlen=strlen (x); in                      for(intI=0; i<len;i++) -                     { to                         if(x[i]>='A'&&x[i]<='Z') +                         { -Putchar (b[x[i]-'A']); the                         } *                         Else $                         {Panax Notoginseng                             if(x[i]>='a'&&x[i]<='Z') -                             { thePutchar (b[x[i]-'a']); +                             } A                             Else the                             { + Putchar (X[i]); -                             } $                         } $                     } -printf"\ n"); -                 } the                  -             }Wuyi         } the         if(strcmp (a[2],s) = =0) -         { Wu             return 0; -         } About     } $}
View Code

ZSC_ Winter Training 5

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.