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 was so incredibly sound, that 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 letter in a plaintext message, you shift it five places to the right to create the secure message (i.e., if the letter is 'A', the cipher text would be 'F'). Since you are creating plain text out of Caesar's messages, you will 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 are shifted in this cipher. Any non-alphabetical character should remain the same, and all alphabetical characters will be upper case.

 

Input

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

A single data set has 3 components:

Start line - A single line, "START"

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

End line - A single line, "END"

Following the final data set will be a single line, "ENDOFINPUT".

 

Output

For each data set, there will be exactly one line of output. This is the original message by Caesar. 
 

Sample Input

START
NS BFW, JAJSYX TK NRUTWYFSHJ FWJ YMJ WJXZQY TK YWNANFQ HFZXJX
END
START
N BTZQI WFYMJW GJ KNWXY NS F QNYYQJ NGJWNFS ANQQFLJ YMFS XJHTSI NS WTRJ
END
START
IFSLJW PSTBX KZQQ BJQQ YMFY HFJXFW NX RTWJ IFSLJWTZX YMFS MJ
END
ENDOFINPUT
 

Sample Output

IN WAR, EVENTS OF IMPORTANCE ARE THE RESULT OF TRIVIAL CAUSES
I WOULD RATHER BE FIRST IN A LITTLE IBERIAN VILLAGE THAN SECOND IN ROME
DANGER KNOWS FULL WELL THAT CAESAR IS MORE DANGEROUS THAN HE
 
 #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
#ifdef CDZSC_OFFLINE
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
char b[]="VWXYZABCDEFGHIJKLMNOPQRSTU";
char *a[]={"START","END","ENDOFINPUT"};
char s[],x[];
while(scanf("%s",s))
{
getchar();
if(strcmp(a[],s)==)
{
while(gets(x))
{
if(strcmp(a[],x)==)
{
break;
}
else
{
int len=strlen(x);
for(int i=;i<len;i++)
{
if(x[i]>='A'&&x[i]<='Z')
{
putchar(b[x[i]-'A']);
}
else
{
if(x[i]>='a'&&x[i]<='z')
{
putchar(b[x[i]-'a']);
}
else
{
putchar(x[i]);
}
}
}
printf("\n");
} }
}
if(strcmp(a[],s)==)
{
return ;
}
}
}

CDZSC_2015寒假新人(1)——基础 e的更多相关文章

  1. CDZSC_2015寒假新人(1)——基础 i

    Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...

  2. CDZSC_2015寒假新人(1)——基础 h

    Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...

  3. CDZSC_2015寒假新人(1)——基础 g

    Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...

  4. CDZSC_2015寒假新人(1)——基础 f

    Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...

  5. CDZSC_2015寒假新人(1)——基础 d

    Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...

  6. CDZSC_2015寒假新人(1)——基础 c

    Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...

  7. CDZSC_2015寒假新人(1)——基础 b

    Description The highest building in our city has only one elevator. A request list is made up with N ...

  8. CDZSC_2015寒假新人(1)——基础 a

    Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...

  9. CDZSC_2015寒假新人(2)——数学 P

    P - P Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

随机推荐

  1. textView富文本点击事件

    NSDictionary * attDic = [NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(31, 132, 204),NSForegrou ...

  2. qq去广告

    首先呢,在文件资源管理器中选择查看"隐藏的项目"或"显示隐藏的文件.文件夹和驱动器"(入口不一样,选择显示隐藏文件的方式也不一样),随后进入 C:\Users\ ...

  3. Socket编程(摘抄)

    http://www.blogjava.net 例子代码就在我的博客中,包括六个UDP和TCP发送接受的cpp文件,一个基于MFC的局域网聊天小工具工程,和此小工具的所有运行时库.资源和执行程序.代码 ...

  4. pp to write

    vanishing gradient problem multi-dimensional lstm

  5. cherry-pick,revert和rebase使用的3-way合并策略

    git中的cherry-pick,revert和rebase都使用的是3-way合并策略,下面就来看看这3个方法使用的merge-base,ours和theirs分别是什么. cherry-pick ...

  6. mysql 5.7占用400M内存优化方案

    mysql出问题了,装了一下新版本,竟然占用400多M的内存,这对于不是服务器,占用是在太高了,再开打一个开发工具,那电脑很卡了,其实是可以优化一下的,在my.ini文件找到这几个参数更改一下,占用大 ...

  7. JavaScript 类的封装以及实现

    类的封装: JavaScript 不是一门面向对象的语言,也不支持类的封装,但是我们可以利用闭包函数的概念去实现类的封装. // 在 Function 内部声明一个闭包函数(对象方法) functio ...

  8. TrimPath - Js模板引擎

    当页面中引用template.js文件之后,脚本将创建一个TrimPath对象供你使用. parseDOMTemplate(elementId,optionalDocument) //获得模板字符串代 ...

  9. C# Exception类

    一.异常类 1.在C#中所有的异常都是使用一个异常类型的示例对象表示的,这些异常类型都是继承自System.Exception类型,或者直接使用System.Exception类型的实例对象: 2.在 ...

  10. 用 Graphviz画神经网络图

    用 Graphviz . 以下代码提供一个例子, 具体使用时做简单修改即可. digraph G { rankdir=LR splines=line nodesep=.05; node [label= ...