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键盘程序员布局很简单.系统设置 -> 键盘 -> 布局设置 -> 点击"+" ->选择"英语(适合程序员的 ...
随机推荐
- NHibernate变的简单
前言 这篇文章出自于我尝试学习使用Nhiberbnate的挫败感.我发现好像Nhibernate全部的介绍材料不是很模糊就是太详细.我所需要的就是一个简单直接的教程,能让我尽快对NHibernate熟 ...
- Python之路Day9
摘要: 协程 Select\Poll\Epoll异步IO与事件驱动 Python连接MySQL数据库操作 RabbitMQ队列 Redis\Memcached缓存 Paramiko Twsited网络 ...
- Python之路Day7
第7天主要是面向对象的内容. 学到现在越来越吃力了,从上节课开始博客就没时间写了,看看别人写的博客都那么棒.又想起了那句话比你牛逼的人都在努力,你却在放羊...唉,我写作业的效率有点低,以后得抓紧时间 ...
- BFS 、DFS 解决迷宫入门问题
问题 B: 逃离迷宫二 时间限制: 1 Sec 内存限制: 128 MB提交: 12 解决: 5[提交][状态][讨论版] 题目描述 王子深爱着公主.但是一天,公主被妖怪抓走了,并且被关到了迷宫. ...
- 一个开源Delphi分类组件推荐网页
https://github.com/Fr0sT-Brutal/awesome-delphi
- Docker 安装命令
curl -sSL https://get.daocloud.io/docker | sh
- hdu4704之费马小定理+整数快速幂
Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Subm ...
- 模拟红外协议C程序——接收模块
目的:方便程序的调试,提供效率,减少工作累,可以不在线调试编程时显示实时数据,特别产品不带显示的或者MCU是OPT的,有很大的帮助. 过程:将要看的数据发送出来,另一个板(一个带有显示的就OK了,显示 ...
- BZOJ 3438: 小M的作物( 最小割 )
orz出题人云神... 放上官方题解... 转成最小割然后建图跑最大流就行了... ---------------------------------------------------------- ...
- PHP - 使用 Pear 进行安装和卸载包
安装: 首先运行到php根目录: 输入要安装的包文件名: 使用语法: pear install 要安装包的名称 回车确认: 如果没有其他意外,显示安装成功. 查看安装的包的信息: 语句: pear i ...