算是c语言题吧、、
给定一行字符串,去掉所有空格,打印每个单词的大写,单词用非字母隔开
#include<iostream>
#include<cstdio>
#include<cstring>
#include<sstream>
#include<algorithm>
using namespace std;
int T, n, m;
char s[1111];
int main() {
string str;
scanf("%d", &n);
getchar();
while(n--) {
getline(cin,str);
stringstream ss(str);
string t;
while(ss >> t) {
char c = toupper(t[0]);
cout << c;
for(int i = 1; i < t.size(); ++i) {
c = toupper(t[i]);
if(isalpha(c) && !isalpha(t[i-1])) {
cout << c;
}
else if(!isalpha(c)) cout << c;
}
}
cout << endl;
}
return 0;
}