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.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 Layout
The QWERTY Layout

Dvorak 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;
听说gets 快要不能用了 好伤心 T T 新的getline慢得要死
#include <bits/stdc++.h>
using namespace std;
char cha(char c)
{
    char a;
    switch(c)
    {
        case 'q':a='\'';break;
        case 'w':a=',';break;
        case 'e':a='.';break;
        case 'r':a='p';break;
        case 't':a='y';break;
        case 'y':a='f';break;
        case 'u':a='g';break;
        case 'i':a='c';break;
        case 'o':a='r';break;
        case 'p':a='l';break;
        case '[':a='/';break;
        case ']':a='=';break;
        case 's':a='o';break;
        case 'd':a='e';break;
        case 'f':a='u';break;
        case 'g':a='i';break;
        case 'h':a='d';break;
        case 'j':a='h';break;
        case 'k':a='t';break;
        case 'l':a='n';break;
        case ';':a='s';break;
        case '\'':a='-';break;
        case 'z':a=';';break;
        case 'x':a='q';break;
        case 'c':a='j';break;
        case 'v':a='k';break;
        case 'b':a='x';break;
        case 'n':a='b';break;
        case 'm':a='m';break;
        case ',':a='w';break;
        case '.':a='v';break;
        case '/':a='z';break;
        case 'Q':a='"';break;
        case 'W':a='<';break;
        case 'E':a='>';break;
        case 'R':a='P';break;
        case 'T':a='Y';break;
        case 'Y':a='F';break;
        case 'U':a='G';break;
        case 'I':a='C';break;
        case 'O':a='R';break;
        case 'P':a='L';break;
        case '{':a='?';break;
        case '}':a='+';break;
        case 'S':a='O';break;
        case 'D':a='E';break;
        case 'F':a='U';break;
        case 'G':a='I';break;
        case 'H':a='D';break;
        case 'J':a='H';break;
        case 'K':a='T';break;
        case 'L':a='N';break;
        case ':':a='S';break;
        case '"':a='_';break;
        case 'Z':a=':';break;
        case 'X':a='Q';break;
        case 'C':a='J';break;
        case 'V':a='K';break;
        case 'B':a='X';break;
        case 'N':a='B';break;
        case 'M':a='M';break;
        case '<':a='W';break;
        case '>':a='V';break;
        case '?':a='Z';break;
        case '-':a='[';break;
        case '_':a='{';break;
        case '=':a=']';break;
        case '+':a='}';break;
        default:a=c;
    }
    return a;
}
char s[1000000];
int main()
{
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    while(gets(s))
    {
        int l=strlen(s);
        for(int i=0;i<l;i++)
        {
            char c=cha(s[i]);
            cout<<c;
        }
        puts("");
    }
    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值