Once in BUET, an old professor had gone completely mad. He started talking with some peculiarwords. Nobody could realize his speech and lectures. Finally the BUET authority fall in great trouble.There was no way left to keep that man working in university. Suddenly a student (definitely he wasa registered author at UVA ACM Chapter and hold a good rank on 24 hour-Online Judge) createda program that was able to decode that professor’s speech. After his invention, everyone got comfortagain and that old teacher started his everyday works as before.
So, if you ever visit BUET and see a teacher talking with a microphone, which is connected to aIBM computer equipped with a voice recognition software and students are taking their lecture fromthe computer screen, don’t get thundered! Because now your job is to write the same program whichcan decode that mad teacher’s speech!
Input
The input file will contain only one test case i.e. the encoded message.
The test case consists of one or more words.
Output
For the given test case, print a line containing the decoded words. However, it is not so hard task toreplace each letter or punctuation symbol by the two immediately to its left alphabet on your standardkeyboard.
Sample Input
k[r dyt I[o
Sample Output
how are you
题解:键盘上的字母错打了2位,找前两位。坑点就是从第一行到第三行是连续的,我去!!!,还有QW是本身。
#include<iostream>
#include<map>
#include<cstring>
#include<stdio.h>
using namespace std;
map<char,char>mp;
int main()
{
char code[100]="qwertyuiop[]asdfghjkl;'zxcvbnm,.";
for(int i=2;i<32;i++)
mp[code[i]]=mp[code[i]-32]=code[i-2];
char s[1000];
gets(s);
for(int i=0;i<strlen(s);i++)
{
if(mp[s[i]])
cout<<mp[s[i]];
else
cout<<s[i];
}
cout<<endl;
return 0;
}