1. Question:
Problem descriptionlp liked a girl, but he did not dare to tell her directly, so he used an encrypted method to write a love letter, hoping that she might understand it one day, but the love letter was accidentally intercepted by me. Now you can decrypt it ~ O (distinct V Branch) O ~~
Encryption Method: as we know, LP is an ACM male, so its encryption method is very closely related to computers, the English letters correspond to the order of the computer keyboard (qwertyuiop ......), For example
A --> q B --> W C --> E d --> r ...... Y --> N z --> m
Now I want to give you some love letter clips and find out the correct answer to his love letter on the computer keyboard ~ The input data contains a string containing spaces. All English letters are in lowercase. Output requires that the text corresponding to the computer keyboard be output. All characters except English letters remain unchanged. Sample Input
zf ykzc hl sj.
Sample output
my name is lp.
Authork
2. Reference code:
#include <iostream>#include <string.h>using namespace std;char a[] = "abcdefghijklmnopqrstuvwxyz";char b[] = "qwertyuiopasdfghjklzxcvbnm";int main(){ char s[1000]; int i, l, k; while (gets(s)) { l = strlen(s); for (i = 0; i < l; i++) { if (s[i] >= 'a' && s[i] <= 'z') { for (k = 0; k < 26; k++) if (s[i] == a[k]) cout << b[k]; } else cout << s[i]; } cout << endl; } return 0;}