Convert QWERTY to Dvorak

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

Submit Status Practice ZOJ 3878

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
`[email protected]#$%^&*()}"‘]_+-=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
`[email protected]#$%^&*()+_-={}[]:"‘<>,.?/\|
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=0;i<str.length();i++){
                if(M.count(str[i]))cout<<M[str[i]];
                else cout<<str[i];
        }
        cout<<endl;
    }
return 0;
}

时间: 2024-12-15 06:59:41

Convert QWERTY to Dvorak的相关文章

12th浙江省省赛 J Convert QWERTY to Dvorak(细节模拟题)

Convert QWERTY to Dvorak 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 brokenCaps Lockkey, so Edward never presses the brokenCaps Lockkey.Luck

zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】

Convert QWERTY to Dvorak 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 Lock key

模拟 ZOJ 3878 Convert QWERTY to Dvorak

题目传送门 1 /* 2 模拟:手敲map一一映射,累! 3 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) 4 */ 5 #include <cstdio> 6 #include <iostream> 7 #include <algorithm> 8 #include <cmath> 9 #include <cstring> 10 #include <string> 11 #include <map&

J - Convert QWERTY to Dvorak——ZOJ

J - Convert QWERTY to Dvorak Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status 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 Loc

ACM学习历程—ZOJ3878 Convert QWERTY to Dvorak(Hash &amp;&amp; 模拟)

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.

OJ Problem Set - 3878 Convert QWERTY to Dvorak

题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3878 1 /* 2 问题 3 很有意思的一道题目,纯模拟,注意细节和最后一行的空格就行了 4 */ 5 6 #include<iostream> 7 #include<string> 8 #include<map> 9 using namespace std; 10 11 int main() 12 { 13 map<char,

ZOJ 3878-Convert QWERTY to Dvorak【模拟】

Convert QWERTY to Dvorak 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 Lock key

2015浙江省赛

ZOJ 3872 :Beauty of Array 对于每个数,计算这个数被累加的次数.找到这个数左边这个数出现的地方,在这之间的所有数的数量*这个数后面的数的数量,即为这个数被计算的次数 <code class="hljs cpp has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pr

2年后,还是放弃了programmer dvorak

写下此文纪念我长达两年的dvorak(以及programmer dvorak,下面都统称dvorak)的使用历程,也给想转换到dvorak的童鞋一些参考经验. 具体的开始时间记不清了,应该是大二的某个时候.那时正是喜欢折腾的时候,折腾过一众linux发行版,ubuntu,xubuntu,fedora,opensuse,还有傻傻装个puppy,做启动U盘到图书馆用那硬盘只有16G的瘦客户机,体验着残缺不全的系统,还不能上网,当时还觉的特自豪. 就是那时听说了dvorak, 这感觉就像高二的时候初识