Michael Scofield's letter


Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4487    Accepted Submission(s): 2535


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!


刚开始以为是输入输出的问题,其实这个题目需要使用集合来做。


此外,不能将结果加起来再输出,这样也是会超时的。

//其实这题可以使用scanner

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Map;

public class Main {
public static void main(String[] args) throws IOException {
StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
// 应该使用集合来做!!
Map<Character, Character> map = new HashMap<Character, Character>();
map.put('b', ' ');
map.put('q', ',');
map.put('t', '!');
map.put('m', 'l');
map.put('l', 'm');
map.put('i', 'e');
map.put('e', 'i');
map.put('c', 'a');
map.put('a', 'c');
while (in.nextToken() != StreamTokenizer.TT_EOF) {
String string = in.sval;
// String res = "";//不能这样加,会超时
char ch[] = string.toCharArray();
for (int i = 0; i < ch.length; i++) {
if (map.get(ch[i]) != null) {
// 如果能在集合中找到
// res += map.get(ch[i]);
out.print(map.get(ch[i]));
out.flush();
} else {
// res += ch[i];
out.print(ch[i]);
out.flush();
}
}
out.println();
// out.println(res);
// out.flush();
}
}
}