ZOJ3878(Convert QWERTY to Dvorak)

来源:互联网 发布:淘宝类目销售比列 编辑:程序博客网 时间:2024/06/10 00:19
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.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:

Qwerty LayoutThe QWERTY Layout
Dvorak LayoutThe 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;doeNfk Gq.d slpt a X,dokt vdtnsaoheKjd yspps,glu pgld; aod yso kd;kgluZ1234567890`~!@#$%^&*()}"']_+-=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`~!@#$%^&*()+_-={}[]:"'<>,.?/\|ABCDEFuvwxyzAXJE>Ugk,qf;相当恶心的一道题,毫无意义!!!只能说毫无意义!!!,想A的直接复制粘贴吧。。。。别费劲了。。
#include<stdio.h>#include<iostream>#include<map>#include<string.h>#include<stdlib.h>using namespace std;int main(){char str[100005];while(gets(str)){int len = strlen(str);for(int i=0;i<len;i++){switch(str[i]){case '_':printf("{");break;case '-':printf("[");break;case '+':printf("}");break;case '=':printf("]");break;case 'Q':printf("\"");break;case 'q':printf("'");break;case 'W':printf("<");break;case 'w':printf(",");break;case 'E':printf(">");break;case 'e':printf(".");break;case 'R':printf("P");break;case 'r':printf("p");break;case 'T':printf("Y");break;case 't':printf("y");break;case 'Y':printf("F");break;case 'y':printf("f");break;case 'U':printf("G");break;case 'u':printf("g");break;case 'I':printf("C");break;case 'i':printf("c");break;case 'O':printf("R");break;case 'o':printf("r");break;case 'P':printf("L");break;case 'p':printf("l");break;case '{':printf("?");break;case '[':printf("/");break;case '}':printf("+");break;case ']':printf("=");break;case 'S':printf("O");break;case 's':printf("o");break;case 'D':printf("E");break;case 'd':printf("e");break;case 'F':printf("U");break;case 'f':printf("u");break;case 'G':printf("I");break;case 'g':printf("i");break;case 'H':printf("D");break;case 'h':printf("d");break;case 'J':printf("H");break;case 'j':printf("h");break;case 'K':printf("T");break;case 'k':printf("t");break;case 'L':printf("N");break;case 'l':printf("n");break;case ':':printf("S");break;case ';':printf("s");break;case '"':printf("_");break;case '\'':printf("-");break;case 'Z':printf(":");break;case 'z':printf(";");break;case 'X':printf("Q");break;case 'x':printf("q");break;case 'C':printf("J");break;case 'c':printf("j");break;case 'V':printf("K");break;case 'v':printf("k");break;case 'B':printf("X");break;case 'b':printf("x");break;case 'N':printf("B");break;case 'n':printf("b");break;case '<':printf("W");break;case ',':printf("w");break;case '>':printf("V");break;case '.':printf("v");break;case '?':printf("Z");break;case '/':printf("z");break;default:printf("%c",str[i]);break;}}putchar('\n');}return 0;}

 
0 0