Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
93542 | 胡海峰老师 | C语言6.11 | C | Wrong Answer | 1 MS | 196 KB | 711 | 2024-10-17 20:04:07 |
//1055 大写转小写 #include <stdio.h> #include <ctype.h> #include <string.h> #define MAX_LENGTH 1000 main() { char sentence[MAX_LENGTH + 1]; fgets(sentence, sizeof(sentence), stdin); int nums=0,letters=0; int spaces =0; int others =0; int n = strlen(sentence); for(int i=0;i<n;i++) { if(isdigit(sentence[i])) { nums++; } else if(isalpha(sentence[i])) { letters++; } else if ( sentence[i]==' ') { spaces++; } else { others++; } } printf("%d %d %d %d\n",letters,spaces,nums,others); return 0; } /* Input What are you doing? 123456 Output 15 4 6 1 */
------Input------
This is 2398239 ! yes!!!!
------Answer-----
9 6 7 5
------Your output-----
9 6 7 6