提交时间:2019-12-21 20:31:30

运行 ID: 3771

#include "iostream" #include "cstdio" #include "cstring" using namespace std; const int maxn=10000000; char ss[maxn]; int main(int argc, char* argv[]) { int n,i; scanf("%d",&n); getchar(); //过滤换行符 while(n--) { gets(ss); for (i=0;i<(int)strlen(ss);i++) { if (i==0) //判断第一个字符 { if (ss[i]>='a'&&ss[i]<='z') { ss[i]-=32; printf("%c",ss[i]); } else if (ss[i]>='A'&&ss[i]<='Z') { printf("%c",ss[i]); } } if (ss[i]==' ') { while(ss[i]==' ') //此语句滤去所有空格 { i++; } if (ss[i]>='a'&&ss[i]<='z') { ss[i]-=32; printf("%c",ss[i]); } else if (ss[i]>='A'&&ss[i]<='Z') { printf("%c",ss[i]); } } } printf("\n"); } return 0; }