题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
include <stdio.h>
int main()
{
char buff[1024]={0}; char table[128]={0}; int total=0; gets(buff); for(int i=0;i<strlen(buff); i++) { table[buff[i]]++; if(table[buff[i]] == 1)//如果第一次出现则总数加一 total++; } printf("%d\n",total); return 0;
}