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:        
  1. Start line - A single line, "START"
  2. Cipher message - A single line containing from one to two hundred characters, inclusive, comprising a single message from Caesar
  3. 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 <string.h>
#include <string>
using namespace std;
int main()
{
string a,b;
while(cin>>a){
if(a=="ENDOFINPUT")break;
if(a=="START"){
string c;
char s[];
int p=;
while(cin>>c){
if(c=="END")break;
int n;
n=c.length();
for(int i=;i<n;i++){
if(c[i]>='A'&&c[i]<='Z'){
if(c[i]-<'A')c[i]=c[i]-+'Z'-'A';
else c[i]-=;
}
s[p]=c[i];
p++;
}
s[p]=' ';
p++;
}
for(int i=;i<p-;i++)cout<<s[i];
cout<<endl;
}
}
//system("pause");
return ;
}

输入输出格式!

C - The Hardest Problem Ever的更多相关文章

  1. HDU1048The Hardest Problem Ever

    The Hardest Problem Ever Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  2. The Hardest Problem Ever(字符串)

    The Hardest Problem Ever Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24039   Accept ...

  3. (字符串 枚举)The Hardest Problem Ever hdu1048

    The Hardest Problem Ever 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1048 Time Limit: 2000/1000 MS ...

  4. HDUOJ-------The Hardest Problem Ever

    The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  5. hdu_1048_The Hardest Problem Ever_201311052052

    The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  6. HDOJ 1048 The Hardest Problem Ever(加密解密类)

    Problem Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caes ...

  7. POJ 1298 The Hardest Problem Ever【字符串】

    Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was ke ...

  8. Poj1298_The Hardest Problem Ever(水题)

    一.Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar eve ...

  9. poj1298 The Hardest Problem Ever 简单题

    链接:http://poj.org/problem?id=1298&lang=default&change=true 简单的入门题目也有这么强悍的技巧啊!! 书上面的代码: 很厉害有没 ...

随机推荐

  1. Performing Post-Build Event之类的编译错误

    如果编译出现Perror PRJ0019: A tool returned an error code from "Performing Post-Build Event..."之 ...

  2. main()和_tmain()有什么区别

    用过C的人都知道每一个C的程序都会有一个main(),但有时看别人写的程序发现主函数不是int main(),而是int _tmain(),而且头文件也不是<iostream.h>而是&l ...

  3. python2 ----函数字典的使用

    问题背景: 最近在用python2为sublime2写一个插件,其中有一个命令功能,就是输入不同的命令调用不同的函数,但是python不支持switch,只用ifelse的话感觉特别的low而且明显不 ...

  4. JS--switch 语句

    说明:js中switch语句的语法风格 function convert(x){ switch(x) { case "string": document.write("s ...

  5. slime+sbcl for common lisp

    sudo apt-get install slime audo apt-get install sbcl ;;sbcl+slime for common lisp ;;sudo apt-get ins ...

  6. Java所有编码问题参考手册

     一.编码基本知识 1.iso8859-1 ——属于单字节编码,最多能表示的字符范围是 0-255,应用于英文系列.比如,字母 'a' 的编码为0x61=97. 很明显,iso8859-1 编码表示的 ...

  7. 安卓手机用-----Exchange Activesync---同步Gmail日历联系人

    微软Exchange Activesync是一个跨平台的移动设备同步协议 支持很多手机操作系统,比如诺基亚的塞班.黑莓的palm.WindowsMobile.Iphone.安卓等.这些手机上都可以用这 ...

  8. JS扩展方法

    JS扩展方法与C#的扩展方法非常相似,也是可以链式调用的,也是通过对某个类的扩展写法来实现.这个东西非常好用,如果将预先写好的方法放到一个js里面引用的话,那么后面写js将非常有趣. 下面给出一个例子 ...

  9. javascript之DOM操作

    一.document.getElementById()    根据Id获取元素节点 <div id="div1"> <p id="p1"> ...

  10. form-validation-engine中的正则表达式

    form-validation-engine是一个不错的表单验证,可以玩玩. (function($) { $.fn.validationEngineLanguage = function() {}; ...