题解 | 简写单词
简写单词
https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4
#include <iostream>
using namespace std;
#include<string>
#include<cctype>
int main() {
int a = 0;
string s, m = "";
getline(cin, s);
m += toupper(s[0]);
while (true)
{
int r = s.find(' ', a);//从a处找到空格第一次出现的的位置
if (r == -1)//没找到返回-1
break;
m += toupper(s[r + 1]);//toupper函数转化为大写,cctype头文件
a = r + 1;
}
cout << m;
}
// 64 位输出请用 printf("%lld")
