ACMUniversity
描述
在大学里,很多单词都是一词多义,偶尔在文章里还要用引申义。这困扰Redraiment很长的时间。
他开始搜集那些单词的所有意义。他发现了一些规律,例如
“a”能用“e”来代替, “c”能用“f”来代替……
现在他给出了字母的替换规则,如下所示,A被E替换,B被C替换,依次类推。
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
E C F A J K L B D G H I V W Z Y M N O P Q R S T U X
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
e r w q t y g h b n u i o p s j k d l f a z x c v m
输入
本题包括多组测试数据。
每组测试数据为一行:为仅由字母和空格组成的字符串(空格不变),长度不超过1000个字符。
输入以单行“#”结束。
输出
对应每组测试数据,替换后输出它的引申义。
样例输入
Ilttabaje zaujljg
#
样例输出
Different meaning
AC code:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
char up[26] ={'E','C','F','A','J','K','L','B','D','G','H','I','V',
'W','Z','Y','M','N','O','P','Q','R','S','T','U','X'};
char low[26] ={'e','r','w','q','t','y','g', 'h', 'b', 'n', 'u', 'i',
'o', 'p', 's', 'j', 'k', 'd', 'l', 'f', 'a', 'z', 'x', 'c', 'v', 'm'};
char input[1005];
while(gets(input),input[0]!='#'){
int len = strlen(input);
for(int i=0; i<len; i++){
if(input[i]>='A' && input[i]<='Z'){
input[i] = up[input[i]-'A'];
}
if(input[i]>='a' && input[i]<='z'){
input[i] = low[input[i]-'a'];
}
}
printf("%s\n",&input); }
return 0;
}
ACMUniversity的更多相关文章
随机推荐
- (servlet页面跳转没有反应)
问题:页面跳转到/UserManager/LoginCLServlet,就一直没有反应,无法继续执行下去(servlet页面跳转没有反应) 解决: doPost()方法里面必须写成这样 正确的写法: ...
- 使用cookie登陆知乎
只是想说明一个问题,Cookie可以维持登录状态,有些网页当中,访问之后的cookie里面带有登陆账号,和登陆密码,这样可以使用cookie直接访问网页,如知乎,首先登录知乎,将Headers中的Co ...
- java中substring()、charAt()、indexOf() (2013-05-05-bd 写的日志迁移
substring 1. public String substring(int beginIndex) 返回一个新的字符串,它是此字符串的一个子字符串, 该子字符串始于指定索引处的字符,一直 ...
- python-10多进程
1-多进程(multiprocessing), 1个父进程可以有多少子进程 1.1下面的例子演示了启动一个子进程并等待其结束 from multiprocessing import Process i ...
- Git Cheatshell - Pro Git
A git cheatshell based on the book: http://www.git-scm.com/book/en/v2. Repository Configuration git ...
- Active Directory 域服务 (AD DS) 虚拟化
TechNet 库 Windows Server Windows Server 2012 R2 和 Windows Server 2012 服务器角色和技术 Active Directory Acti ...
- Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support (LEMP) On Ubuntu 12.04 LTS [repost]
from : http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ub ...
- USACO Section2.1 Sorting a Three-Valued Sequence 解题报告
sort3解题报告 —— icedream61 博客园(转载请注明出处)---------------------------------------------------------------- ...
- leetcode 【Rotate List 】python 实现
题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Giv ...
- iphone 8 plus 红色特别版,突然自动关机无法启动
今天早上我的iphone 8p 突然自己在床上闪动开机图标,闪了半个多小时它就光荣的自动关机了,我尝试了长按开机键,长按home+开机键15秒,通通木有用,它就是没!反!应! 于是找了售后,学到了正确 ...