HDOJ 1048 The Hardest Problem Ever

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 #include <string>
 5 #include <string.h>
 6 
 7 using namespace std;
 8 
 9 char p[27] = "VWXYZABCDEFGHIJKLMNOPQRSTU";
10 
11 void ip(string& s){
12     int len = s.length();
13     for(int i = 0;i<len;++i){
14         if(s[i]>='A'&&s[i]<='Z'){
15            s[i] = p[s[i]-'A'];
16         }
17     }
18 }
19 
20 int main(){
21     string s;
22     while(getline(cin,s)&&s=="START"){
23         getline(cin,s);
24         ip(s);
25         cout<<s<<endl;
26         getline(cin,s);
27     }
28     return 0;
29 }

简单的字符串处理问题。

posted @ 2017-03-13 21:58  Lueagle  阅读(167)  评论(0编辑  收藏  举报