标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 49003 Accepted Submission(s): 27058
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 int main(){ 5 string s; 6 while(getline(cin, s)){ 7 char c = ‘ ‘; 8 for(int i = 0; i < s.length(); i++){ 9 if(c == ‘ ‘){ 10 s[i] = s[i] - ‘a‘ + ‘A‘; 11 } 12 c = s[i]; 13 } 14 cout << s << endl; 15 } 16 return 0; 17 }
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 int main(){ 5 string s; 6 while(getline(cin, s)){ 7 for(int i = 0; i < s.length()-1; i++){ 8 if( s[i] == ‘ ‘ ) 9 s[i+1] = s[i+1] - ‘a‘ + ‘A‘; 10 if(i == 0) 11 s[i] = s[i] - ‘a‘ + ‘A‘; 12 } 13 cout << s << endl; 14 } 15 return 0; 16 }
标签:
原文地址:http://www.cnblogs.com/qinduanyinghua/p/5559060.html