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 had only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all of the other keys in the QWERTY keyboard work well. Every day, he had 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 is in the following:
Input
A QWERTY document Edward typed. The document has no more than kibibytes. And there is no invalid characters in the document.
Output
The Dvorak document.
Sample Input
JGW Gqm ANDPW a h.soav patsfk f;doenfk gq.d slpt a x,dokt vdtnsaohekjd Yspps,glu pgld; AOD yso kd;kgluz1234567890 ' [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 is for testing:1234567890 ' [email protected]#$%^&* () +_-={}[]: ' <>,.? /\| abcdefuvwxyzaxje>ugk,qf;
Test instructions: Enter the character of the upper keyboard, and the character of the corresponding position on the bottom of the keyboard note the escape character processing
#include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> #define INF 0x3f3f3f#define DD double#define MAX 110using namespace Std;char A[max];char c;char str[]= {"-=_+qwertyuiop[]qwertyuiop{ }ASDFGHJKL; ' Asdfghjkl:\ "ZXCVBNM,./ZXCVBNM<>?"}; Char s[]= {"[]{} ',. pyfgcrl/=\" <>pyfgcrl?+aoeuidhtns-aoeuidhtns_;qjkxbmwvz:qjkxbmwvz "};int main () {while (scanf ("%c", &c)!=eof) { int ok=0; int Len=strlen (str); for (int i=0; i<len; i++) if (str[i]==c) { printf ("%c", S[i]); ok=1;} if (!ok) printf ("%c", c);} return 0;}
Zoj 3878 Convert QWERTY to Dvorak "good pit simulation"