J - Convert QWERTY to Dvorak
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld
& %llu
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<stdio.h> #include<string.h> int i; char s[10000010]; int main() { while(gets(s)!=NULL) { i=0; while(s[i]!='\0') { if(s[i]=='_') s[i]='{'; else if(s[i]=='-') s[i]='['; else if(s[i]=='+') s[i]='}'; else if(s[i]=='=') s[i]=']'; else if(s[i]=='Q') s[i]='"'; else if(s[i]=='q') s[i]=39; else if(s[i]=='W') s[i]='<'; else if(s[i]=='w') s[i]=','; else if(s[i]=='E') s[i]='>'; else if(s[i]=='e') s[i]='.'; else if(s[i]=='R') s[i]='P'; else if(s[i]=='r') s[i]='p'; else if(s[i]=='T') s[i]='Y'; else if(s[i]=='t') s[i]='y'; else if(s[i]=='Y') s[i]='F'; else if(s[i]=='y') s[i]='f'; else if(s[i]=='U') s[i]='G'; else if(s[i]=='u') s[i]='g'; else if(s[i]=='I') s[i]='C'; else if(s[i]=='i') s[i]='c'; else if(s[i]=='O') s[i]='R'; else if(s[i]=='o') s[i]='r'; else if(s[i]=='P') s[i]='L'; else if(s[i]=='p') s[i]='l'; else if(s[i]=='{') s[i]='?'; else if(s[i]=='[') s[i]='/'; else if(s[i]=='}') s[i]='+'; else if(s[i]==']') s[i]='='; else if(s[i]=='S') s[i]='O'; else if(s[i]=='s') s[i]='o'; else if(s[i]=='D') s[i]='E'; else if(s[i]=='d') s[i]='e'; else if(s[i]=='F') s[i]='U'; else if(s[i]=='f') s[i]='u'; else if(s[i]=='G') s[i]='I'; else if(s[i]=='g') s[i]='i'; else if(s[i]=='H') s[i]='D'; else if(s[i]=='h') s[i]='d'; else if(s[i]=='J') s[i]='H'; else if(s[i]=='j') s[i]='h'; else if(s[i]=='K') s[i]='T'; else if(s[i]=='k') s[i]='t'; else if(s[i]=='L') s[i]='N'; else if(s[i]=='l') s[i]='n'; else if(s[i]==':') s[i]='S'; else if(s[i]==';') s[i]='s'; else if(s[i]=='"') s[i]='_'; else if(s[i]==39) s[i]='-'; else if(s[i]=='Z') s[i]=':'; else if(s[i]=='z') s[i]=';'; else if(s[i]=='X') s[i]='Q'; else if(s[i]=='x') s[i]='q'; else if(s[i]=='C') s[i]='J'; else if(s[i]=='c') s[i]='j'; else if(s[i]=='V') s[i]='K'; else if(s[i]=='v') s[i]='k'; else if(s[i]=='B') s[i]='X'; else if(s[i]=='b') s[i]='x'; else if(s[i]=='N') s[i]='B'; else if(s[i]=='n') s[i]='b'; else if(s[i]=='<') s[i]='W'; else if(s[i]==',') s[i]='w'; else if(s[i]=='>') s[i]='V'; else if(s[i]=='.') s[i]='v'; else if(s[i]=='?') s[i]='Z'; else if(s[i]=='/') s[i]='z'; i++; } puts(s); } return 0; }
时间: 2024-10-12 11:23:30