n a^o7 !

n a^o7 !

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my instructions, which can make you in the best state preparing to fight. Now please relax yourself and enjoy the good moment. Before you raise your sharp sword to the enemy who guards the battleground, please allow me to tell you a true and romantic story about a samurai like you.
Samurai hh fell in love with girl ss, who is charming and demure. He realized the truth that he must spend his remaining life with ss, and resolved to pursue the hard-won affection. One day hh wrote a letter to ss, when she opens the letter with excitement her mind was in tangle. She found herself completely not to figure out the meaning about the letter, which said that “n 55!w ! pue n a^o7 ! n paau !”. ss also immersed herself in guessing the meaning of that letter for a long time because of her adore to hh. Finally she called hh to ask the meaning of the letter. On the other side of the phone, hh was too nervous to say. Gradually he calmed down himself and told ss to reverse the letter and read it. Then on both ends of the phone comes the voice at the same time “i need u i love u and i miss u”.
ss wants to tell each of you however you are Brave And Skilled, you shouldn’t forget to express your loyal love and romantic feelings to your prince or princess.
Now the horn sounds for battle,do it by the following input and output. I think each of you will get an “Accepted” in this battle with pleasant mood.

Input

Input contains an integer T in the first line, and then T lines follow .Each line contains a message (only contain ‘n5!wpuea^o7!’ and
’ ‘(space)), the message’s length is no more than 100.

Output

Output the case number and the message. (As shown in the sample output)

Sample Input

2
n 55!w ! pue n a^o7 ! n paau !
n5!wpuea^o7

Sample Output

Case 1: i need u i love u and i miss u
Case 2: loveandmisu

**Hint

Source**
2012年”浪潮杯”山东省第三届ACM大学生程序设计竞赛

这个题刚开始以为很难,其实就是把样例上下倒过来看就能明白。
但是终于明白一个问题,就是gets()和scanf()的区别。
大概就是gets()输入时可以带有空格,但是scanf()输入时,会以空格,回车为结束,所以不能用scanf()输入带有空格的字符串。


#include <stdio.h>

#include <string.h>
int main()
{
    int t,i,l,k;
    char s[109];
    scanf("%d",&t);
    k=0;
    for(k=1; k<=t; k++)
    {
        if(k==1) //这个地方输入时没有回车,所以要把换行的回车吞掉
        getchar();//不然会直接结束
        gets(s);
        l=strlen(s);
        printf("Case %d: ",k);
        for(i=l-1; i>=0; i--)
        {
            if(s[i]=='n')
                printf("%c",'u');
            if(s[i]=='5')
                printf("%c",'s');
            if(s[i]=='!')
                printf("%c",'i');
            if(s[i]=='p')
                printf("%c",'d');
            if(s[i]=='u')
                printf("%c",'n');
            if(s[i]=='e')
                printf("%c",'a');
            if(s[i]=='a')
                printf("%c",'e');
            if(s[i]=='^')
                printf("%c",'v');
            if(s[i]=='o')
                printf("%c",'o');
            if(s[i]=='7')
                printf("%c",'l');
            if(s[i]==' ')
                printf(" ");
            if(s[i]=='w')
                printf("m");


        }
        printf("\n");
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/Aviana_j/article/details/81975610