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. MongoDb笔记(一)

    1.Mongodb 数据库是动态生成的可以使用use 数据库名 来指定要使用的数据库,如果数据库不存在就自动生成一个 2.插入一个文档:db.foo.insert({"name": ...

  2. asp.net缓存(三)

    Asp.net应用程序数据缓存 System.Web.Caching 命名空间提供用于缓存服务器上常用数据的类.此命名空间包括 Cache 类,该类是一个字典,您可以在其中存储任意数据对象,如哈希表和 ...

  3. C# 十进制和十六进制转换

    转至:http://www.cnblogs.com/fwind/archive/2012/04/13/2445380.html 在C#中,十进制和十六进制转换非常简单,方法如下: 十进制转为十六进制: ...

  4. JS截取字符串:slice(),substring()和substr()

    var string='abcdefg' 1.slice() string.slice(startLocation [, endLocation]) ps1:2个参数可以为负数,若参数值为负数,则将该 ...

  5. C++程序中不同变量、函数在内存中内存中的分布情况

    一.一个C++编译的程序占用的内存分为以下几个部分 1.栈区:由编译器自动分配 存放函数的参数值,局部变量的值等,操作方式类似于数据结构中的栈. 2.堆区:一般由程序员分配释放,若程序员不释放,程序结 ...

  6. (原+转)VS2013:正在从以下位置加载符号

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5158020.html 这段时间启动调试时,vs2013加载时间很长很长...然后下面网址给出了解决方法 ...

  7. UnSupported Encoding错误

    学习struts2的时候碰到tomcat报错:org.apache.jasper.JasperException: Unsupported encoding:  UTF-8,原因是jsp文件中的pag ...

  8. FPGA系统中DRAM,SRAM,SDRAM,FLASH 区别(转)

    原文:http://hi.baidu.com/abners/item/a9042ef35d3f005bc8f337f5 一般来说这几种存储器是一个nios系统都具有的,sram的好处是接口简单,速度快 ...

  9. java使用poi创建excel文件

    import org.apache.poi.hssf.usermodel.HSSFCell;import org.apache.poi.hssf.usermodel.HSSFRow;import or ...

  10. Types of Binary Tree

    Complete Binary Tree According to wiki, A complete binary tree is a binary tree in which every level ...