Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133261 陈梓钒 词组缩写 C++ Accepted 1 MS 276 KB 540 2025-10-18 11:41:06

Tests(1/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int b; cin>>b; cin.get(); for(int i=1;i<=b;i++){ string s; getline(cin,s); for(int j=0;j<=s.length()-1;j++){ if(j==0&&s[j]>='a'&&s[j]<='z'){ cout<<char(s[0]-32); } else if(j==0&&s[j]>='A'&&s[j]<='Z'){ cout<<s[0]; } if(s[j]==' '&&s[j+1]>='a'&&s[j+1]<='z'){ cout<<char(s[j+1]-32); } else if(s[j]==' '&&s[j+1]>='A'&&s[j+1]<='Z'){ cout<<s[j+1]; } } cout<<endl; } return 0; }