链接:

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5526

Time Limit: 2 Seconds      Memory Limit: 65536 KB


Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lockkey. Luckily, all the other keys on the QWERTY keyboard work well. Every day, he has a lot of documents to type. Thus he needs a converter to translate QWERTY into Dvorak. Can you help him?

The QWERTY Layout and the Dvorak Layout are in the following:

The QWERTY Layout

The Dvorak Layout

Input

A QWERTY document Edward typed. The document has no more than 100 kibibytes. And there are no invalid characters in the document.

Output

The Dvorak document.

Sample Input

Jgw Gqm Andpw a H.soav Patsfk f;doe
Nfk Gq.d slpt a X,dokt vdtnsaohe
Kjd yspps,glu pgld; aod yso kd;kgluZ
1234567890
`~!@#$%^&*()}"']_+-=ZQqWEwe{[\|
ANIHDYf.,bt/
ABCDEFuvwxyz

Sample Output

Hi, I'm Abel, a Dvorak Layout user.
But I've only a Qwerty keyboard.
The following lines are for testing:
1234567890
`~!@#$%^&*()+_-={}[]:"'<>,.?/\|
ABCDEFuvwxyz
AXJE>Ugk,qf;

代码:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h> #define N 100000 char s1[] = "_-+=qWwEeRrTtYyUuIiOoPp{[}]SsDdFfGgHhJjKkLl:;'ZzXxCcVvBbNnMm<,>.?/";
char s2[] = "{[}]'<,>.PpYyFfGgCcRrLl?/+=OoEeUuIiDdHhTtNnSs-:;QqJjKkXxBbMmWwVvZz"; int main()
{
char s[N], ch='"'; while(gets(s))
{
int i;
for(i=; s[i]; i++)
{
int flag=, a;
char ss[]; ss[] = s[i];
ss[] = '\0'; if(s[i]==ch)
printf("_"), flag = ;
else if(s[i]=='Q')
printf("%c", ch), flag = ;
else if(strstr(s1, ss))
{
a = strstr(s1, ss) - s1;
printf("%c", s2[a]);
flag = ;
} if(flag==) printf("%c", s[i]);
} printf("\n");
}
return ;
}

(字符串 键盘转换)Convert QWERTY to Dvorak -- zoj -- 5526的更多相关文章

  1. 模拟 ZOJ 3878 Convert QWERTY to Dvorak

    题目传送门 /* 模拟:手敲map一一映射,累! 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) */ #include <cstdio> #include &l ...

  2. zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】

    Convert QWERTY to Dvorak Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, a poor copy typis ...

  3. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial ...

  4. Convert QWERTY to Dvorak

      Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  5. ACM学习历程—ZOJ3878 Convert QWERTY to Dvorak(Hash && 模拟)

    Description Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY ...

  6. ZOJ Problem Set - 3878 Convert QWERTY to Dvorak

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3878 /* 问题 很有意思的一道题目,纯模拟,注意细节和最后一 ...

  7. linux bash shell:最方便的字符串大小写转换(lowercase/uppercase conversion) (转)

    原文地址:https://blog.csdn.net/10km/article/details/83384145 关于字符串大小写转换,是写 linux 脚本经常干的事儿,所以总想找个方便的方法让我少 ...

  8. JAVA将数字字符串强制转换成整型变量----求参数之和实验代码(附流程图)

    一.设计思想 先将参数个数输出,并利用循环结果将参数逐个输出,再将字符串强制转化成整型,利用循环结构相加求和 二.程序流程图 三.源程序代码 package demo; public class Co ...

  9. Java中不同转换符实现不同数据类型到字符串的转换

    String类的format()方法用于创建格式化的字符串以及连接多个字符串对象.熟悉C语言的同学应该记得C语言的sprintf()方法,两者有类似之处.format()方法有两种重载形式. form ...

随机推荐

  1. npm查看全局安装过的包

    在使用node的时候,用npm安装了很多软件,过一段时间没有使用就会忘记,怎么查看自己全局安装过的包,用命令 npm list -g --depth 0 在百度里搜不到结果的,我在google里老外的 ...

  2. emacs之配置4,颜色插件

    来自https://github.com/oneKelvinSmith/monokai-emacs/blob/master/monokai-theme.el monokai-theme.el ;;; ...

  3. RDLC报表系列一

    1.报表项目搭建: 配置好后,单击Web服务URL:http://lg-20151517ryre/ReportServer 如果电脑系统打开的时候没有设置密码的话,此时打开有可能会出现需要登录名和密码 ...

  4. 转 linux 下装 usb driver

    http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux

  5. 关于diskgenius删除所有分区后,电脑不能识别U盘的问题。

    楼主曾今为了将Linux系统安装至U盘中,曾无数次对U盘进行过格式化,到最后导致,u盘各种引导.系统.烂数据存在U盘,导致U盘的使用越来越不方便.后来终于下狠心,利用diskgenius对U盘进行一次 ...

  6. uva-110-没有for循环的排序

    题意:看输出就懂了,暴力枚举题,字符串最大长度是8,所有长度等于8的长度是8!=1x2x3x4x5x6x7x8=40320,数据量比较小的.只是枚举的方向比较怪异,如下,长度等于3的串 a ab,ba ...

  7. C#串口编程测试收发

    原文:http://www.cnblogs.com/vsdot/archive/2013/04/23/3263348.html   基本传递方法:RS232传输要有1位起始位,8位数据位.1位校验位( ...

  8. C# JSON 序列化

    1.JavaScriptSerializer System.Web.Extensions.dll System.Web.Script.Serialization命名空间 Serialize Deser ...

  9. 【328】Python 控制鼠标/键盘+图片识别 综合应用

    本文是基于 [267]实现跨网络传数据 的基础上的,由于在弹出 putty 之后,需要手动输入命令(pass.sh.get.sh)来实现数据的传递,另外就是处理完之后需要手动关闭 putty,本文解决 ...

  10. tensorflow笔记 :常用函数说明

    常用函数说明,梯度.产生变量等 http://blog.csdn.net/c2a2o2/article/details/69061539