zoj3878——Convert QWERTY to Dvorak
2016-04-02 18:47
447 查看
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 Lock key. 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:
我想跟出这个题的人好好谈谈!
Lock key, so Edward never presses the broken Caps Lock key. 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 <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <cstdio> #define MAXN 1000000 using namespace std; char a[MAXN+10]; char conven(char a) { if(a=='-') return '['; else if(a=='_') return '{'; else if(a=='+') return '}'; else if(a=='=') return ']'; else if(a=='Q') return '"'; else if(a=='q') return '\''; else if(a=='W') return '<'; else if(a=='w') return ','; else if(a=='E') return '>'; else if(a=='e') return '.'; else if(a=='R') return 'P'; else if(a=='r') return 'p'; else if(a=='T') return 'Y'; else if(a=='t') return 'y'; else if(a=='Y') return 'F'; else if(a=='y') return 'f'; else if(a=='U') return 'G'; else if(a=='u') return 'g'; else if(a=='I') return 'C'; else if(a=='i') return 'c'; else if(a=='O') return 'R'; else if(a=='o') return 'r'; else if(a=='P') return 'L'; else if(a=='p') return 'l'; else if(a=='{') return '?'; else if(a=='[') return '/'; else if(a=='}') return '+'; else if(a==']') return '='; else if(a=='S') return 'O'; else if(a=='s') return 'o'; else if(a=='D') return 'E'; else if(a=='d') return 'e'; else if(a=='F') return 'U'; else if(a=='f') return 'u'; else if(a=='G') return 'I'; else if(a=='g') return 'i'; else if(a=='H') return 'D'; else if(a=='h') return 'd'; else if(a=='J') return 'H'; else if(a=='j') return 'h'; else if(a=='K') return 'T'; else if(a=='k') return 't'; else if(a=='L') return 'N'; else if(a=='l') return 'n'; else if(a==':') return 'S'; else if(a==';') return 's'; else if(a=='"') return '_'; else if(a=='\'') return '-'; else if(a=='Z') return ':'; else if(a=='z') return ';'; else if(a=='X') return 'Q'; else if(a=='x') return 'q'; else if(a=='C') return 'J'; else if(a=='c') return 'j'; else if(a=='V') return 'K'; else if(a=='v') return 'k'; else if(a=='B') return 'X'; else if(a=='b') return 'x'; else if(a=='N') return 'B'; else if(a=='n') return 'b'; else if(a=='<') return 'W'; else if(a==',') return 'w'; else if(a=='>') return 'V'; else if(a=='.') return 'v'; else if(a=='?') return 'Z'; else if(a=='/') return 'z'; else return a; } int main() { int i; while(gets(a)) { for(i=0;a[i]!='\0';++i) a[i]=conven(a[i]); for(i=0;a[i]!='\0';++i) printf("%c",a[i]); printf("\n"); } return 0; }
相关文章推荐
- Micro2440开发板启动Linux
- [NOIP2013][CODEVS3287]货车运输(kruskal+树上倍增)
- Java并发编程系列之八:wait()、notify()和notifyAll()
- 第九章 原型模式
- 可视化深度学习和人类感知Visualizing Representations: Deep Learning and Human Beings-1
- Spring学习---1
- URL链接中汉字乱码转UTF-8和gb2312
- 一步一步利用django创建博客应用(二)
- zoj2876——May Day Holiday(算星期)
- Java内存区域划分
- ubuntu下安装编译链
- 快速排序
- Micro2440数据传输---串口通信
- ROS基础环境的配置
- select标签中显示指定内容
- shell 脚本执行日志通用模块
- 《古文字学》学习
- Android开发:解决android:gravity不能居中问题
- UFLDL Tutorial 笔记
- Android开发中的一个小功能 清空搜索框的文字