Sweety

Practice makes perfect

导航

第三届山东ACM省赛 n a^o7 !

Posted on 2016-05-04 15:12  蓝空  阅读(128)  评论(0编辑  收藏  举报


#include <iostream>  
#include <cstdio>  
#include <string>  
#include <cstring>  
#define MAX 500  
using namespace std;  
int main (){  
 char temp1[MAX],temp2[MAX],str[MAX];  
 strcpy(temp1," n5!wpuea^o7!usimdnaevoli");  
 strcpy(temp2," usimdnaevolin5!wpuea^o7!");  
 int Len = strlen(temp1);  
 int T;  
 scanf("%d",&T);  
 getchar();  
 int coun=1;  
 while(T--){  
   gets(str);  
   int len=strlen(str);  
   for(int i=0,j=0;i<len;i++){  
    for(j=0;j<Len;j++)  
       if(str[i]==temp1[j])  
          break;  
     if(j<Len) str[i]=temp2[j];  
   }  
   printf("Case %d: ",coun++);  
   for(int i=len-1;i>=0;i--)  
     printf("%c",str[i]);  
   printf("\n");  
 }  
return 0;  
}