题解 | #简写单词#
简写单词
https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4
#include <stdio.h> #include <string.h> #define N 5100 char s[N]; char toUpper(char c) { if (c >= 'a' && c <= 'z') return c - 32; return c; } int main() { gets(s); for (int i = 0; i < strlen(s); i ++ ) { if (i == 0 || s[i - 1] == ' ') { char c = toUpper(s[i]); printf("%c", c); } } return 0; }