文章
24
粉丝
0
获赞
253
访问
7.8k
#include<bits/stdc++.h>
using namespace std;
int main() {
vector<string> words;
string s;
while(getline(cin, s)) {
string word;
int n = s.length();
s[0] = toupper(s[0]);
for(int i = 0; i < n; i ++) {
if(s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n') {
s[i + 1] = toupper(s[i + 1]);
words.push_back(word);
word.clear();
} else {
word += s[i];
}
}
words.push_back(word);
for(int i = 0; i < (int)words.size(); i ++) {
cout << words[i];
if(i < (int)words.size()) {
cout << " ";
}
}
cout << endl;
words.clear();
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发