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. Cocoapods依赖管理

    对于iOS App的开发,几乎都采用了Cocoapods来管理第三方库,那么对于开发人员来说,这是必备技能,必须要掌握如何使用.这篇文章就是介绍如何安装和使用CocoaPods的. 简单来说,就是专门 ...

  2. QTestlib Manual翻译

    Trolltech公司提供的QTestlib框架,是一种针对基于QT编写的程序或库的单元测试工具.QTestLib提供了单元测试框架的基本功能,并提供了针对GUI测试的扩展功能. 目录: QtestL ...

  3. 记录一下C#+Oracle批量插入的一个方法

    public bool insertOracle(DataTable dataTable, string sql) // Oracle sql 查询的是表头 { string ConnStr = Wi ...

  4. 基于VMware的eCos环境编译redboot(脚本配置redboot)

    基于VMware的ecos,redboot及hello world(1)安装请参照[[ecos学习2]wmware运行redboot[方法二]--图形实现配置 ] (2)修改内存布局文件:~/i386 ...

  5. [Head First Python]2. BIF(内置函数)

    1- range() >>> for each in range(2): print(each) ... 0 1

  6. 利用raspberry pi搭建typecho笔记(一) nginx PHP server quick start

    前言 因为一直对linux学习很有兴趣,就拿手头的树莓派做了实验,搭建一个简易的php服务器用来跑typecho. 但是过程却是异乎寻常的艰辛,几乎每一步能卡住得地方都卡住了.而且typecho的资料 ...

  7. Bulk-Only传输协议 UFI命令块规范

    USB设备分为5大类,即显示器.通信设备.音频设备.人机输入和海量存储.通常所用的U盘.移动硬盘均属于海量存储类.海量存储类的规范中包括4个独立的子规范,即CBI传输.Bulk-Only传输.ATA命 ...

  8. Qt编程之QtScript

    需求是这样的: 需要给一个硬件接口测试些东西,用js来调用,js做成不同的独立模块分别测试不同的硬件接口,包括DMD内存,PCIE带宽等等.需要用一个exe来载入这些js文件分别调用测试模块.exe用 ...

  9. tr 替换删除字符

    1.关于tr    通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能.您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符.您 ...

  10. 什么是队列(Queue)?

    类似于链表和堆栈,队列也是存储数据的结构.队列中数据进入队列的顺序很重要,一般来说,队列就是一群人或者事物按照排好的顺序等待接受服务或者处理. 定义:队列,又称为伫列(queue),是先进先出(FIF ...