题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <stdio.h> int main() { char arr[500]; scanf("%s",arr); int count = 0; char cmp[128] = {0}; int ret =0; while(arr[count++] != '\0') { ; } for(int i = 0;i < count - 1;i++) { cmp[arr[i]]++; } for(int i = 0;i < 128;i++) { if(cmp[i] > 0) { if(i>=0 && i <= 127) { ret++; } } cmp[i] = '\0'; } printf("%d\n",ret); return 0; }