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键盘程序员布局很简单.系统设置 -> 键盘 -> 布局设置 -> 点击"+" ->选择"英语(适合程序员的 ...
随机推荐
- [Swust OJ 465]--吴奶奶买鱼(0-1背包+dfs)
题目链接:http://acm.swust.edu.cn/problem/465/ 还有一道题只是描述不一样,方法一模一样(http://acm.swust.edu.cn/problem/644/) ...
- BZOJ 1103: [POI2007]大都市meg( 树链剖分 )
早上数学考挂了...欲哭无泪啊下午去写半个小时政治然后就又可以来刷题了.. 树链剖分 , 为什么跑得这么慢... ------------------------------------------- ...
- ZOJ 2852 Deck of Cards DP
题意: 一一个21点游戏. 1. 有三个牌堆,分别为1X,2X,3X. 2. 纸牌A的值为1,纸牌2-9的值与牌面面相同,10(T).J.Q.K的值为10,而而joke(F)的值为 任意大大. 3. ...
- form的验证用法
models.py forms.py html页面 第二种方法: 不继承model直接自定义内容 获得内容: if form.is_valid(): price = reques ...
- js中innerHTML与innerText的用法与区别
用法: <div id="test"> <span style="color:red">test1</span> te ...
- WPF: 针对Windows 8优化菜单栏和工具栏
原文 WPF: 针对Windows 8优化菜单栏和工具栏 目录 1. 关于菜单图标大小 2. 关于IsEnabled和工具栏图标 3. 针对.NET 3.x的菜单栏和工具栏外观 返回目录 1. 关于菜 ...
- Debian为程序添加一个开始菜单,debian添加sublime开始菜单.
下了一个 '绿色' 的程序,想要加到开始菜单里面. 怎么做呢? 我这里以sublime2做例 去http://www.sublimetext.com/2 下载了linux 64位, 解压放到了下面的文 ...
- JAVA思维导图系列:多线程0基础
感觉自己JAVA基础太差了,又一次看一遍,已思维导图的方式记录下来 多线程0基础 进程 独立性 拥有独立资源 独立的地址 无授权其它进程无法訪问 动态性 与程序的差别是:进程是动态的指令集合,而程序是 ...
- Zabbix Step 1 : Install CentOS6.5 and Configration
[root@myzabbix Desktop]#rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2- ...
- 关于Cocos2d-x 3.0正式版 粒子问题在IOS上正常显示,在Android下有问题的解决方式
前几个在Cocos2d-x论坛上,有人提到粒子系统的问题..这里列举一下解决的方法: 或许到时候大家用粒子效果的时候也会发现这个问题,如今把这个问题的解决办法说出来.至于原因我也不知道是引擎的问题还是 ...