- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- ifstream in;
- ofstream ou;
- in.open("read.txt");
- ou.open("write.txt");
- string b;
- int a;
- cin>>a;
- for(int i=0;i<a;i++)
- {
- getline(in,b);
- for(int j=0;j<b.size();j++)
- {
- if(j==0)
- b[j]=b[j]-'a'+'A';
- else if(b[j-1]==' ')
- b[j]=b[j]-'a'+'A';
- }
- ou<<b<<endl;
- }
- in.close();
- ou.close();
- return 0;
- }
複製代碼 |