zoukankan      html  css  js  c++  java
  • Michael Scofield's letter

    Michael Scofield's letter

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

    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<iostream>
    using namespace std;
    int main()
    {
    	char a[10002];
    	while(gets(a)){
    		int len=strlen(a),i;
    		for(i=0;i<len;i++){
    			switch(a[i])
    			{
    				case 'b':cout<<" ";break;
    				case 'q':cout<<",";break;
    				case 't':cout<<"!";break;
    				case 'm':cout<<"l";break;
    				case 'i':cout<<"e";break;
    				case 'c':cout<<"a";break;
    				case 'a':cout<<"c";break;
    				case 'e':cout<<"i";break;
    				case 'l':cout<<"m";break;
    				default:cout<<a[i];
    			}
    		}
    		cout<<endl;
    	}
    	return 0;
    }

     
  • 相关阅读:
    【PAT】 B1006 换个格式输出整数
    【PAT】B1014 福尔摩斯的约会
    【PAT】B1005 继续(3n+1)猜想
    【PAT】B1004 成绩排名
    【PAT】B1003 我要通过!
    【PAT】B1002 写出这个数
    【PAT】B1001 害死人不偿命的(3n+1)猜想
    【PAT】A1001A+B Format
    【PAT】B1027 打印沙漏(20 分)
    【PAT】B1032 挖掘机技术哪家强(20 分)
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3053740.html
Copyright © 2011-2022 走看看