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!

就是输入一行字符串,然后根据b is ‘空格’, q is ‘,’, t is ‘!’, m is l, i is e, c is a, a is c, e is i, l is m.来转换,输出转换之后的字符串!

在这里,我用Map来存储需要转换的字符,然后查找输出。

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner; public class Main{ public static void main(String[] args) {
Map<Character, Character> map = new HashMap<Character, Character>();
map.put('b', ' ');
map.put('q', ',');
map.put('t', '!');
map.put('m', 'l');
map.put('i', 'e');
map.put('c', 'a');
map.put('a', 'c');
map.put('e', 'i');
map.put('l', 'm');
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str=sc.next();
for(int i=0;i<str.length();i++){
if(map.get(str.charAt(i))!=null){
System.out.print(map.get(str.charAt(i)));
}else{
System.out.print(str.charAt(i));
}
}
System.out.println();
}
}
}

HDOJ/HDU 2140 Michael Scofield's letter(字符转换~)的更多相关文章

  1. HDU 2140 Michael Scofield's letter

    http://acm.hdu.edu.cn/showproblem.php?pid=2140 Problem Description I believe many people are the fan ...

  2. HDOJ(HDU) 4847 Wow! Such Doge!(doge字符统计)

    Problem Description Chen, Adrian (November 7, 2013). "Doge Is An Ac- tually Good Internet Meme. ...

  3. HDOJ/HDU 1161 Eddy's mistakes(大写字母转换成小写字母)

    Problem Description Eddy usually writes articles ,but he likes mixing the English letter uses, for e ...

  4. HDOJ(HDU).1035 Robot Motion (DFS)

    HDOJ(HDU).1035 Robot Motion [从零开始DFS(4)] 点我挑战题目 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架/双重DF ...

  5. HDOJ(HDU).1015 Safecracker (DFS)

    HDOJ(HDU).1015 Safecracker [从零开始DFS(2)] 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架/双重DFS HDOJ.1 ...

  6. HDU 2087 剪花布条(字符串匹配,KMP)

    HDU 2087 剪花布条(字符串匹配,KMP) Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案.对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出 ...

  7. HDOJ(HDU).1412 {A} + {B} (STL SET)

    HDOJ(HDU).1412 {A} + {B} (STL SET) 点我挑战题目 题意分析 大水题,会了set直接用set即可. 利用的是set的互异性(同一元素有且仅有一项). #include ...

  8. HDOJ(HDU).1754 I Hate It (ST 单点替换 区间最大值)

    HDOJ(HDU).1754 I Hate It (ST 单点替换 区间最大值) 点我挑战题目 题意分析 从题目中可以看出是大数据的输入,和大量询问.基本操作有: 1.Q(i,j)代表求区间max(a ...

  9. HDOJ(HDU).1166 敌兵布阵 (ST 单点更新 区间求和)

    HDOJ(HDU).1166 敌兵布阵 (ST 单点更新 区间求和) 点我挑战题目 题意分析 根据数据范围和询问次数的规模,应该不难看出是个数据结构题目,题目比较裸.题中包括以下命令: 1.Add(i ...

随机推荐

  1. [001] winnie the pooh - 读后记

    winnie the pooh 我是在伍君仪透析英语视频培训班,获得这本书的,PDF格式的(排版不是很好,和当当上的相比有部分章节缺失) 这是我第一本采用透析法读完的英文书. 今天(2015年10月2 ...

  2. (LightOJ 1004) Monkey Banana Problem 简单dp

    You are in the world of mathematics to solve the great "Monkey Banana Problem". It states ...

  3. cleartool mkview snapshot windows

    mkview 用法详解:mkview - Support - IBM 创建View的命令相对来讲十分直截了当. cleartool mkview -snapshot -tag ViewName -vw ...

  4. (转)Object-C 中各数据类型转换 NSData转NSString,Byte,UIImage

    ,NSData 与 NSString NSData --> NSString NSString *aString = [[NSString alloc] initWithData:adata e ...

  5. IOS视图旋转可放大缩小

    - (IBAction)hideBut:(id)sender { if (self.flg) { [UIView animateWithDuration:0.3 animations:^{ self. ...

  6. H5小内容(三)

    Canvas(画布)   基本内容     简单来说,HTML5提供的新元素<canvas>     Canvas在HTML页面提供画布的功能       在画布中绘制各种图形     C ...

  7. Yii 权限分级式访问控制实现(非RBAC法)

    以下由我们在信易网络公司开发项目的时候终结出的一些经验 主要参考资料:yii官网http://www.yiiframework.com/wiki/60/yii framework 提供了2套权限访问系 ...

  8. ul动态增加li

    --> aaa bbb <%@ page language="java" import="java.util.*" pageEncoding=&qu ...

  9. 强大DevExpress,Winform LookUpEdit 实现多列查询 gridview弹出下拉选择 z

    关键代码请参考http://www.devexpress.com/Support/Center/p/K18333.aspx 最新DEMO 下载 The current GridLookUpEdit's ...

  10. Clang 与 LLVM

    我们在iOS调试中经常会看到Clang这个,那么Clang到底是什么呢?我们来简单了解一下. Clang是一个C.C++.OC语言的轻量级编译器.源代码发布于BSD协议下.Clang是由C++编写,基 ...