CDZSC_2015寒假新人(1)——基础 e
Description
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
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
Sample Input
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
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的更多相关文章
- CDZSC_2015寒假新人(1)——基础 i
Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...
- CDZSC_2015寒假新人(1)——基础 h
Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...
- CDZSC_2015寒假新人(1)——基础 g
Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...
- 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 ...
- 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 ...
- CDZSC_2015寒假新人(1)——基础 c
Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...
- CDZSC_2015寒假新人(1)——基础 b
Description The highest building in our city has only one elevator. A request list is made up with N ...
- CDZSC_2015寒假新人(1)——基础 a
Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...
- CDZSC_2015寒假新人(2)——数学 P
P - P Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
随机推荐
- Object-c学习之路十(NSNumber&NSValue)
// // main.m // NSNumberAndNSValue // // Created by WildCat on 13-7-26. // Copyright (c) 2013年 wildc ...
- TextView之一:子类的常用属性
TextView常见的子类包括EditText,Button,CheckBox, RadioButton等. 1.EditText EditText继承自TextView,因此TextView所有属性 ...
- JavaScript对象(一)——Function对象
写在最前面: 对象只是带有属性和方法的特殊数据类型(js的7种数据类型:字符串,数字,布尔,数组,对象,null,undefined). JavaScript是面向对象的语言,但是JavaScript ...
- 为采集动态网页安装和测试Python Selenium库
1. 引言上一篇<为编写网络爬虫程序安装Python3.5>中测试小例子对静态网页做了一个简单的采集程序,而动态网页因为需要动态加载js获取数据,所以使用urllib直接openurl已经 ...
- 实用AutoHotkey功能展示
AutoHotkey是什么 AutoHotkey是一个自动化脚本语言. AutoHotkey有什么用 可以让你用热键操控一切,操作电脑就像在表演魔术 我的口号 AutoHotkey!用过都说好! Au ...
- MVC中配置OutputCache的VaryByParam参数无效的问题
在项目使用OutputCacheAttribute是遇到了问题,当我想在配置文件web.config中配置OutputCache的VaryByParam时竟然不起作用,下面是相关代码: 文件FaceC ...
- EditText获取焦点监听事件_EditText获取和失去焦点操作
今天在做搜索框的时候.遇到需要获取焦点之后做一些事情.实现方法也很简单.那就是绑定OnFocusChangeListener事件.实现 onFocusChange(View v, boolean ha ...
- Structs2中Action返回json到前台方法
1.传统方式JSON输出 这一点跟传统的Servlet的处理方式基本上一模一样,代码如下 01 public void doAction() throws IOException{ 02 ...
- Climbing Stairs 解答
Question You are climbing a stair case. It takes n steps to reach to the top. Each time you can eith ...
- HDMI相关知识
HDMI热插拔检测原理 HDMI(19Pin)/DVI(16 pin)的功能是热插拔检测(HPD),这个信号将作为主机系统是否对HDMI/DVI是否发送TMDS信号的依据.HPD是从显示器输出送往计算 ...