SDUT——Mirror, Mirror on the Wall 解题报告
原题:
题目描述#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ char a[30]; while(1) { scanf("%s",&a); if(strcmp(a,"#")==0) break; int l=strlen(a); for(int i=0; i<l; i++) { if((a[i]!='i')&&(a[i]!='o')&&(a[i]!='v')&&(a[i]!='w')&&(a[i]!='x')&&(a[i]!='b')&&(a[i]!='d')&&(a[i]!='p')&&(a[i]!='q')) { printf("INVALID\n"); break; } } for(int j=l; j>=0; j--) { if(a[j]=='i') printf("i"); else if(a[j]=='o') printf("o"); else if(a[j]=='v') printf("v"); else if(a[j]=='w') printf("w"); else if(a[j]=='x') printf("x"); else if(a[j]=='b') printf("d"); else if(a[j]=='p') printf("q"); else if(a[j]=='q') printf("p"); else if(a[j]=='d') printf("b"); } printf("\n"); } return 0;}