博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
(字符串 键盘转换)Convert QWERTY to Dvorak -- zoj -- 5526
阅读量:6308 次
发布时间:2019-06-22

本文共 1986 字,大约阅读时间需要 6 分钟。

链接:

 

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:

Qwerty Layout
The QWERTY Layout

Dvorak 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;doeNfk Gq.d slpt a X,dokt vdtnsaoheKjd yspps,glu pgld; aod yso kd;kgluZ1234567890`~!@#$%^&*()}"']_+-=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`~!@#$%^&*()+_-={}[]:"'<>,.?/\|ABCDEFuvwxyzAXJE>Ugk,qf;

 

 

 

代码:

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

 

转载于:https://www.cnblogs.com/YY56/p/4749664.html

你可能感兴趣的文章
在市场营销中使用敏捷方法:过程、团队与成功案例
查看>>
新书问答:Agile Management
查看>>
苹果将iOS应用带入macOS
查看>>
react入门
查看>>
VUE高仿饿了么app
查看>>
针对Kubernetes软件栈有状态服务设计的思考
查看>>
你的可用性达标了吗?云端业务性能高可用的深度实践
查看>>
linux yum清缓存脚本
查看>>
基于epoll封装的事件回调miniserver
查看>>
天猫高管全面解读大快消2018新零售打法
查看>>
idea springboot热部署无效问题
查看>>
第八章 进程间通信
查看>>
HttpSession接口中的方法(Jsp中的session类的用法)
查看>>
「镁客早报」AI可预测心脏病人死亡时间;机器人开始在美国送外卖
查看>>
MoQ(基于.net3.5,c#3.0的mock框架)简单介绍
查看>>
物联网全面升级,十年内推动工业进入智能化新阶段
查看>>
spring-通过ListFactory注入List
查看>>
一种基于SDR实现的被动GSM嗅探
查看>>
阿里云ECS每天一件事D1:配置SSH
查看>>
SQL Server 性能调优(性能基线)
查看>>