Convert QWERTY to Dvorak
Description
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:
| 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<map>
using namespace std;
map<char,char>M;
void init(){
M['-']='['; M['A']='A'; M['X']='Q';
M['_']='{'; M['a']='a'; M['x']='q';
M['+']='}'; M['s']='o'; M['C']='J';
M['=']=']'; M['S']='O'; M['c']='j';
M['Q']='"'; M['D']='E'; M['V']='K';
M['q']='\''; M['d']='e'; M['v']='k';
M['W']='<'; M['F']='U'; M['B']='X';
M['w']=','; M['f']='u'; M['b']='x';
M['E']='>'; M['G']='I'; M['N']='B';
M['e']='.'; M['g']='i'; M['n']='b';
M['R']='P'; M['H']='D'; M['M']='M';
M['r']='p'; M['h']='d'; M['m']='m';
M['T']='Y'; M['j']='h'; M['<']='W';
M['t']='y'; M['K']='T'; M[',']='w';
M['Y']='F'; M['J']='H'; M['>']='V';
M['y']='f'; M['k']='t'; M['.']='v';
M['U']='G'; M['L']='N'; M['?']='Z';
M['u']='g'; M['l']='n'; M['/']='z';
M['I']='C'; M[':']='S'; M['{']='?';
M['i']='c'; M[';']='s'; M['[']='/';
M['O']='R'; M['"']='_'; M['}']='+';
M['o']='r'; M['\'']='-'; M[']']='=';
M['P']='L'; M['Z']=':';
M['p']='l'; M['z']=';';
}
int main(){
init();
string str;
while(getline(cin,str)){
for(int i=;i<str.length();i++){
if(M.count(str[i]))cout<<M[str[i]];
else cout<<str[i];
}
cout<<endl;
}
return ;
}
Convert QWERTY to Dvorak的更多相关文章
- 模拟 ZOJ 3878 Convert QWERTY to Dvorak
题目传送门 /* 模拟:手敲map一一映射,累! 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) */ #include <cstdio> #include &l ...
- 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 ...
- zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】
Convert QWERTY to Dvorak Time Limit: 2 Seconds Memory Limit: 65536 KB Edward, a poor copy typis ...
- (字符串 键盘转换)Convert QWERTY to Dvorak -- zoj -- 5526
链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5526 Time Limit: 2 Seconds Memor ...
- 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 ...
- ZOJ Problem Set - 3878 Convert QWERTY to Dvorak
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3878 /* 问题 很有意思的一道题目,纯模拟,注意细节和最后一 ...
- 说说qwerty、dvorak、colemak三种键盘布局
[qwerty布局] qwerty布局大家应该都很熟悉了,全世界最普及的键盘布局. 截止到去年接触并使用dvorak布局之前,我使用了十几年qwerty布局,在http://speedtest.10f ...
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第三部分)
Earthstone Keeper Time Limit: 4 Seconds Memory Limit: 65536 KB Earthstone Keeper is a famous ro ...
- gnome设置dvorak键盘布局
若桌面环境为gnome,设置Dvorak键盘程序员布局很简单.系统设置 -> 键盘 -> 布局设置 -> 点击"+" ->选择"英语(适合程序员的 ...
随机推荐
- Acitivity的一些属性配置
转自:http://blog.csdn.net/javayinjaibo/article/details/8855678 1.android:allowTaskReparenting 这个属性用来标记 ...
- POJ 3675 Telescope 简单多边形和圆的面积交
这道题得控制好精度,不然会贡献WA QAQ 还是那个规则: int sgn(double x){ if(x > eps) return 1; else if(x < - eps) ret ...
- x64栈结构
A function's prolog is responsible for allocating stack space for local variables, saved registers, ...
- 死锁 android ANR
以下为一段ANR的LOG,主要是在WindowManagerService.java和ActivityManagerService.java中实现. W/WindowManager( 2183): K ...
- Sql 参数的使用
代码片段: a)声明实例 1.声明SQLCommand实例. SqlCommand cmd = new SqlCommand(); 2.声明SqlDataAdapter实例. SqlDataAdapt ...
- POJ1700(过河问题)
#include<iostream> #include<algorithm> using namespace std; ]; int main() { int t,i; cin ...
- WebStorm 7.0 注册码
User Name: EMBRACE License Key:===== LICENSE BEGIN =====24718-1204201000001h6wzKLpfo3gmjJ8xoTPw5mQvY ...
- Docker学习笔记(4) — 开启Docker远程访问
默认情况下,Docker守护进程会生成一个socket(/var/run/docker.sock)文件来进程本地进程通信,而不会监听任何端口,因此只能在本地使用docker客户端或者使用Docker ...
- poj3070 Fibonacci 矩阵快速幂
学了线代之后 终于明白了矩阵的乘法.. 于是 第一道矩阵快速幂.. 实在是太水了... 这差不多是个模板了 #include <cstdlib> #include <cstring& ...
- 安卓开发06:布局-线性布局 LinearLayout
LinearLayout把视图组织成一行或一列.子视图能被安排成垂直的或水平的.线性布局是非常常用的一种布局方式. 请看一个布局例子: <LinearLayout xmlns:android=& ...