HDU 2140 Michael Scofield's letter

http://acm.hdu.edu.cn/showproblem.php?pid=2140

Problem Description

I believe many people are the fans of prison break. How clever Michael is!! In order that the message won‘t be found by FBI easily, he usually send code letters to Sara by a paper crane. Hence, the paper crane is Michael in the heart of Sara. Now can you write a program to help Sara encode the letter from Michael easily?
The letter from Michael every time is a string of lowercase letters. You should encode letters as the rules below:
b is ‘ ‘, q is ‘,‘, t is ‘!‘, m is l, i is e, c is a, a is c, e is i, l is m. It is interesting. Are you found that it is just change michael to leahcim?

Input

The input will consist of several cases, one per line.
Each case is a letter from Michael, the letteres won‘t exceed 10000.

Output

For each case, output the encode letter one line.

Sample Input

pmicsibforgevibliqbscrct

ebmovibyout

Sample Output

please forgive me, sara!

i love you!

代码:

#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;
char s[maxn];
char a[11]={‘b‘, ‘q‘, ‘t‘, ‘m‘, ‘i‘, ‘c‘, ‘a‘, ‘e‘, ‘l‘};
char b[11]={‘ ‘,  ‘,‘, ‘!‘, ‘l‘, ‘e‘, ‘a‘, ‘c‘, ‘i‘, ‘m‘};

int main() {
    while(~scanf("%s", s)) {
        int len = strlen(s);
        for(int i = 0; i < len; i ++) {
            if(s[i] == ‘b‘)
                s[i] = ‘ ‘;
            else if(s[i] == ‘t‘)
                s[i] = ‘!‘;
            else if(s[i] == ‘m‘)
                s[i] = ‘l‘;
            else if(s[i] == ‘i‘)
                s[i] = ‘e‘;
            else if(s[i] == ‘c‘)
                s[i] = ‘a‘;
            else if(s[i] == ‘a‘)
                s[i] = ‘c‘;
            else if(s[i] == ‘e‘)
                s[i] = ‘i‘;
            else if(s[i] == ‘l‘)
                s[i] = ‘m‘;
            else if(s[i] == ‘q‘)
                s[i] = ‘,‘;
        }

        printf("%s\n", s);
    }
    return 0;
}

  

HDU 2140 Michael Scofield's letter

原文地址:https://www.cnblogs.com/zlrrrr/p/9410836.html

时间: 2024-11-01 22:19:22

HDU 2140 Michael Scofield's letter的相关文章

HDOJ/HDU 2140 Michael Scofield&#39;s letter(字符转换~)

Problem Description I believe many people are the fans of prison break. How clever Michael is!! In order that the message won't be found by FBI easily, he usually send code letters to Sara by a paper crane. Hence, the paper crane is Michael in the he

hdu 3511 Prison Break

http://acm.hdu.edu.cn/showproblem.php?pid=3511 题意: 给出n个相离或包含的圆,问最里层的圆是第几层 竖着的扫描线与圆在最左侧相切时 1.线在圆的上方或下方无交点,则该圆在第1层 2.线在圆的上下方都有交点,且上下方的交点属于同一个圆C,则该圆在圆C的里面一层 3.线在圆的上下方都有交点,上方交于圆E,下方交于圆F,EF其中一个在另一个里面,则该圆与在里面的那个圆处在同一层 4.线在圆的上下方都有交点,上方交于圆E,下方交于圆F,EF在同一层,则该圆

越狱Season 1-Episode 1: the pilot

the pilot: 美国电视剧新剧开播都会有一个试播来测试观众对新剧的接受程度,以此来决定是否再继续播下去,也可以说是一个开端,第一集,试播 -Tattoo Artist: That's it. tatoo: 纹身  artist: 艺术家 完成了. Can I just, you know, look at it for a minute? minute: 分钟 能让我欣赏下吗? You're an artist, Sid. artist: 艺术家 你真是个艺术家,Sid. You're t

越狱Season 1-Episode 19: The Key

Season 1, Episode 19: The Key -Kellerman: WeusedtohaveaGreatDane, Dane: 丹麦大狗 我们以前有一只大丹犬 bigandwild. wild: 野蛮的 又大又凶 Whenshewas12,shegotcancer,sowe cancer: 癌症 她12岁时得了癌症 hadtoputherdown. 我们不得不了结了她 Andyoucouldthinkitwouldbe 你以为那场面 hisbig,dramaticevent,bu

越狱Season 1-Episode 11: And Then There Were 7-M

Season 1, Episode 11: And Then There Were 7-M -Michael: That one 那个 -businessman: Nice choice choice: 选择 眼光不错 -Michael: Thanks. 谢谢 -businessman: Platinum platinum: 白金 白金 Brushed. brushed: 拉过绒的 拉丝的 -Michael: Six point two five point: 点 6.25克? -busines

越狱Season 1-Episode 12:Odd Man Out

Season 1-Episode 12:Odd Man Out -Sorry to keep you waiting. 抱歉让你等了半天 -Oh, it's, uh, not a problem. 嗯没关系 -Hmm. Impressive resume. impressive: 令人印象深刻的  resume: 简历 嗯简历令人印象深刻 -Thank you. 谢谢 -Tell me why you chose to pursue a career in engineering. choose

越狱Season 1- Episode 18: Bluff

Season 1, Episode 18: Bluff -Michael: Scofield Scofield Michael Scofield Michael Scofield -Patoshik: Doesn't ring a bell 记不起来 -Michael: wind back a while in Gen Pop Cell 40 cell: 囚室 回忆一下大牢房40号囚室? -Patoshik: Gen Pop 大牢房 -Michael: General Population. O

越狱Season 1-Episode 4: Cute Poison

Season 1, Episode 4: Cute Poison [Previously on Prison Break] previously: 以前地 前情提要 -Burrows: I didn't kill that man, Michael 那人不是我杀的 Michael -Michael: the evidence says you did evidence: 证据证明 有证据的 -Burrows: I was set up 我是被陷害的 -police: Put down your

越狱Season 1-Episode 2: Allen

Season 1, Episode 2: Allen [Previously, on Prison Break] previously: 以前(预先) 前情回顾 -Judge: I find it incumbent that you see the inside of a prison cell incumbent: 必须履行的:有义务的 我必须判你牢狱之刑 Mr. Scofield. Scofield先生 -Fernando: Why do you want to see Burrows s