题解 | #简写单词# getline的使用
简写单词
https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4
#include<iostream> #include<cstring> using namespace std; void printf(char a) { if (a >= 'A' && a <= 'Z') ; else if (a >= 'a' && a <= 'z') a = a - 32; cout << a; return; } int main() { string a; getline(cin, a); int n = a.length(); printf(a[0]); for (int i = 0; i < n; i++) { if (a[i] == ' ') printf(a[i + 1]); } }