题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <stdio.h>
#include <string.h>
//数组标记法很好解决有没有,有几类的问题。
int main() {
char str[501];
scanf("%[^\n]",str);
int sg[128]={0};
int l;
l=strlen(str);
for(int i=0;i<l;i++)
{
char a=str[i];
int b=a;
sg[b]=sg[b]+1;
}
int m=0;
for(int j=0;j<128;j++)
{
if(sg[j]!=0)
{
m=m+1;
}
}
printf("%d",m);
}

