IBM Minus One

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3943 Accepted Submission(s): 1519
 
Problem Description
You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the same name by Stanley Kubrick. In it a spaceship is sent from Earth to Saturn. The crew is put into stasis for the long flight, only two men are awake, and the ship is controlled by the intelligent computer HAL. But during the flight HAL is acting more and more strangely, and even starts to kill the crew on board. We don't tell you how the story ends, in case you want to read the book for yourself :-)

After the movie was released and became very popular, there was some discussion as to what the name 'HAL' actually meant. Some thought that it might be an abbreviation for 'Heuristic ALgorithm'. But the most popular explanation is the following: if you replace every letter in the word HAL by its successor in the alphabet, you get ... IBM.

Perhaps there are even more acronyms related in this strange way! You are to write a program that may help to find this out.

 
Input
The input starts with the integer n on a line by itself - this is the number of strings to follow. The following n lines each contain one string of at most 50 upper-case letters.
 
Output
For each string in the input, first output the number of the string, as shown in the sample output. The print the string start is derived from the input string by replacing every time by the following letter in the alphabet, and replacing 'Z' by 'A'.

Print a blank line after each test case.

 
Sample Input
2
HAL
SWERC
 
Sample Output
String #1
IBM String #2
TXFSD
 
 
Source
Southwestern Europe 1997, Practice
 
Recommend
Ignatius.L
 

调用了库函数

 #include <iostream>
#include <cstdio> using namespace std; int main(){
int n;
scanf("%d",&n); int i;
for(i = ; i < n ; ++i){
string str;
cin >> str; int length = str.length(); // 提取字符串的长度 是关键
int j;
for(j = ; j < length ; ++j){
if(str[j] == 'Z'){
str[j] = 'A';
}else{
str[j] += ;
}
} cout << "String #" << (i+) <<endl;
cout<<str<<endl<<endl;
} return ;
}

最新文章

  1. Android爬坑之路
  2. SlickUpload 发布到IIS后报错
  3. 【转】Java日期计算之Joda-Time
  4. GCC 编译详解
  5. C++学习笔记15:操作符重载的函数原型列表(推荐)
  6. sgu - 269 - Rooks
  7. umount nfs状态为busy的处理方法
  8. 标准的最大margin问题
  9. jmeter命令行运行-单节点
  10. RabbitMQ系列教程之二:工作队列(Work Queues)
  11. PHP数组按引用传递
  12. MySQL(六)之MySQL常用操作符
  13. MyEclipse10+Flash Builder4+BlazeDS+Tomcat7配置J2EE Web项目报错(一)
  14. 使用vlookup嵌套INDIRECT函数实现跨表数据引用
  15. CSharpGL(49)试水OpenGL软实现
  16. ArcGis dbf读写——挂接Excel到属性表 C#
  17. 《CSS世界》读书笔记(十四)
  18. springmvc+hibernate在实体类中设置外键
  19. 【SVM】周志华
  20. SJW-遍历我的账户左侧导航页面(句柄切换)

热门文章

  1. 7z文件格式及其源码的分析
  2. spring和redis的整合
  3. 桥接模式及C++实现 C++设计模式-AbstractFactory抽象工厂模式
  4. 验证视图状态 MAC 失败,解决方法
  5. [Android笔记1]Activity+Layout+Button
  6. cf 323A A. Black-and-White Cube 立体构造 不知道为什么当k为奇数时构造不出来 挺有趣的题目吧
  7. Eclipse 4.3正式版发布
  8. Android 架构艺术之MVP
  9. 背水一战 Windows 10 (38) - 控件(布局类): Panel, Canvas, RelativePanel, StackPanel, Grid
  10. Python 调用shell