LP love letter

Source: Internet
Author: User

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;}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.