题解 | #简写单词#
简写单词
https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4
#include <stdio.h> int main() { char ar1[5000], ar2[50]; gets(ar1); int i = 0, j = 0; while (ar1[i]) { if (ar1[i] == ' ') { if (ar1[i + 1] >= 97) { ar1[i + 1] = ar1[i + 1] - 32; } ar2[j] = ar1[i + 1]; j++; } if (i == 0) { if (ar1[i] >= 97) { ar1[i] = ar1[i] - 32; } ar2[j] = ar1[i]; j++; } i++; } for (i = 0; i < j; i++) { printf("%c", ar2[i]); } return 0; }