标签:
Description
Input
Output
Sample Input
Sample Output
1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 using namespace std; 6 int main() 7 { 8 #ifdef CDZSC_OFFLINE 9 freopen("in.txt","r",stdin); 10 freopen("out.txt","w",stdout); 11 #endif 12 char b[]="VWXYZABCDEFGHIJKLMNOPQRSTU"; 13 char *a[]={"START","END","ENDOFINPUT"}; 14 char s[15],x[250]; 15 while(scanf("%s",s)) 16 { 17 getchar(); 18 if(strcmp(a[0],s)==0) 19 { 20 while(gets(x)) 21 { 22 if(strcmp(a[1],x)==0) 23 { 24 break; 25 } 26 else 27 { 28 int len=strlen(x); 29 for(int i=0;i<len;i++) 30 { 31 if(x[i]>=‘A‘&&x[i]<=‘Z‘) 32 { 33 putchar(b[x[i]-‘A‘]); 34 } 35 else 36 { 37 if(x[i]>=‘a‘&&x[i]<=‘z‘) 38 { 39 putchar(b[x[i]-‘a‘]); 40 } 41 else 42 { 43 putchar(x[i]); 44 } 45 } 46 } 47 printf("\n"); 48 } 49 50 } 51 } 52 if(strcmp(a[2],s)==0) 53 { 54 return 0; 55 } 56 } 57 }
标签:
原文地址:http://www.cnblogs.com/guofeng1022/p/4239990.html