题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <stdio.h>
#include <string.h>
int main(){
int num[1000], len, temp, i, j;
char str[1000];
int map[128] = {0};
j = 0;
gets(str);
len = strlen(str);
//字符串转换成整型
for (i = 0; i < len; i++)
{
num[i] = (int)(str[i]);
temp = num[i];
if (map[temp] == 0)
{
map[temp]++;
}
}
for (i = 0; i < 128; i++)
{
if (map[i] == 1)
j++;
}
printf("%d", j);
return 0;
}