这题让我一脸懵逼了好久,好久不做字符串都不会处理了,现在若是比赛我还真不一定能做出来= =。
刚开始不知道"字符串中表示前面要加\,编译一直通不过。。。
然后编译出来字符不对,原来是忘了加break,还以为表打错了看了好久。。。
最后发现连换行都忘了,真失败啊。。。
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <queue>
#include <string.h>
using namespace std;
const int N = 500;
const int INF = 1000000;
char a1[] = {"-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"};
char a2[] = {"[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"};
int main()
{
// freopen("in.txt", "r", stdin);
char a;
int i;
while(~scanf("%c", &a))
{
if(a == '\n') printf("\n");
else
{
int len = strlen(a1);
for(i = 0; i < len; i ++)
{
if(a == a1[i])
{
a = a2[i];
break;
}
}
printf("%c", a);
}
}
return 0;
}