题解 | 字符个数统计
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <stdio.h>
#include <stdbool.h>
int main()
{
char word;
bool hash[130] = {false};
int count = 0;
word = getchar();
while (word != '\n')
{
hash[word] = true;
word = getchar();
}
for (int i = 0; i < sizeof(hash); i++)
{
if (hash[i])
count++;
}
printf("%d\n", count);
return 0;
}
查看14道真题和解析