ZOJ3878(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;

相当恶心的一道题,毫无意义!!!只能说毫无意义!!!,想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
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值