/*********************************
* 日期:2013-2-7
* 作者:SJF0115
* 题号: 九度OJ 题目1134:密码翻译
* 来源:http://ac.jobdu.com/problem.php?pid=1134
* 结果:AC
* 来源:2008年北京大学软件所计算机研究生机试真题
* 总结:
**********************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int i,j,n;
char string[80];
//freopen("C:\\Users\\SJF\\Desktop\\acm.txt","r",stdin);
while(scanf("%d\n",&n) != EOF)
{
for(i = 0;i < n;i++){
gets(string);
for(j = 0;j < strlen(string);j++){
//把其中从a-y,A-Y的字母用其后继字母替代
if((string[j] >= 'a' && string[j] <= 'y') || (string[j] >= 'A' && string[j] <= 'Y')){
string[j] = string[j] + 1;
}
//把z和Z用a和A替代
else if(string[j] == 'z' || string[j] == 'Z'){
string[j] = string[j] - 25;
}
}
puts(string);
}
}
return 0;
}
九度OJ 题目1134:密码翻译
最新推荐文章于 2024-06-09 19:52:10 发布