HDU 1048 - The Hardest Problem Ever

让你改一改字符

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 using namespace std;
 5 char s[105];
 6 const char list[]={'V','W','X','Y','Z','A','B','C','D','E','F','G'
 7                     ,'H','I','J','K','L','M','N','O','P','Q','R','S'
 8                     ,'T','U'};
 9 int main()
10 {
11     while(gets(s))
12     {
13         if(strcmp(s,"ENDOFINPUT")==0) break;
14         while(gets(s))
15         {
16             if(strcmp(s,"END")==0) break;
17             for(int i=0;s[i]!='\0';i++)
18             {
19                 if(s[i]<='Z'&&s[i]>='A') cout<<list[s[i]-'A'];
20                 else cout<<s[i];
21             }
22             cout<<endl;
23         }
24     }
25 } 

 

posted @ 2016-05-03 21:39  nicetomeetu  阅读(126)  评论(0编辑  收藏  举报