题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
int main(void)
{
char ch;
int hash[150] = {0};
int sum = 0;
while ((ch = getchar()) != '\n')
{
int index = (int) ch;
hash[index] = 1;
}
for (int i = 0; i < 128; ++i)
{
sum += hash[i];
}
printf("%d\n", sum);
return 0;
}