代码(C++)
#include <iostream>
#include <string>
using namespace std;
int main() {
string str = "I like acm first second time test";
cout << str << endl;
int flag = 0;
for (int i = 0; str[i] != '\0'; ++i) {
if (flag) {
str[i] = str[i] - ' ';
flag = 0;
}
if (str[i] == ' ') {
flag = 1;
}
}
cout << str << endl;
return 0;
}