一直AC不了,请帮忙修改~请不要只发个链接,啥都不说!!
Description
一个集合里只有小写字母(个数不超过1000),集合会以括号的形式给出,
小写字母用逗号分隔开来,现在问你该集合里有多少互不相同的英文字母。
Input
每组测试数据一行,表示一个只有小写字母的集合,小写字母个数 <= 1000。
Output
对于每一组测试数据输出该集合里有多少互不相同的英文字母。
Sample Input 1
{a, b, c}
{b, a, b, a}
Sample Output 1
3
2
我写的代码如下:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char temp;
int count,flag[123];
while((temp=getchar()) != EOF)
{
if(temp == '{')
{
count=0;
memset(flag,0,sizeof(flag));
continue;
}
else if(islower(temp) && !flag[temp])
{
count++;
flag[temp]=1;
continue;
}
else if(temp == '}')
{
printf("%d\n",count);
continue;
}
else
continue;
}
return 0;
}
运行后judger给的结果是WA