n a^o7 !
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
2n 55!w ! pue n a^o7 ! n paau !n5!wpuea^o7
Sample Output
Case 1: i need u i love u and i miss uCase 2: loveandmisu
Hint
Source
解题思路:字符串处理的题目,只需按照题意将字符一一对应,然后从字符串最后一位开始处理。
AC代码:
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
void translate(char ori[], int len, char tans[])
{
int i, j;
for(i = 0, j = len -1; i < len; i++, j--)
{
switch(ori[j])
{
case '7':tans[i] = 'l';break;
case 'o':tans[i] = 'o';break;
case '^':tans[i] = 'v';break;
case 'a':tans[i] = 'e';break;
case 'e':tans[i] = 'a';break;
case 'u':tans[i] = 'n';break;
case 'n':tans[i] = 'u';break;
case 'p':tans[i] = 'd';break;
case 'w':tans[i] = 'm';break;
case '!':tans[i] = 'i';break;
case '5':tans[i] = 's';break;
case ' ':tans[i] = ' ';break;
}
}
}
int main()
{
int t;
char ori[105];
char tans[105];
int i;
int j;
scanf("%d\n", &t);
for(i = 1; i <= t; i++)
{
int len = 0;
gets(ori);
len = strlen(ori);
translate(ori,len,tans);
printf("Case %d: ", i);
for(j = 0; j < len; j++)
{
printf("%c", tans[j]);
}
printf("\n");
}
return 0;
}