题解 | #简写单词#
简写单词
https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4
#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
char a;
string str;
a = getchar();
str = str + (char)toupper(a);
while ((a = getchar()) != '\n')
{
if (a == ' ')
{
a = getchar();
str = str + (char)toupper(a);
}
}
cout << str;
}
// 64 位输出请用 printf("%lld")
直接使用toupper转化为大写
C++题解 文章被收录于专栏
记录在牛客网用C++刷题的题解思路
