为什么只输入字母或数字时会少一个,字母和数字都有时是正常的
#include<stdio.h>int main()
{
char expert;
int letter=0,blank=0,digit=0,other=0;
printf("expert:");
scanf("%c",&expert);
while((expert=getchar())!='\n'){
if(expert>='a'&&expert<='z'||'A'<=expert&&expert<='Z1'){
letter++;
}
else if('0'<=expert&&expert<='9'){
digit++;
}
else if(expert==' '){
blank++;
}
else
other++;}
printf("letter=%d\n",letter);
printf("balnk=%d\n",blank);
printf("digit=%d\n",digit);
printf("other=%d\n",other);
return 0;
}