题目大意:对于给定的一个字符串,统计其中数字字符出现的次数。
代码实现:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
int n;
while(~scanf("%d",&n)){
while(n--){
int cnt=0;
char s[1000];
scanf("%s",s);
int l=strlen(s);
for(int i=0;i<l;i++){
if(!isalpha(s[i]))
cnt++;
}
printf("%d\n",cnt);
}
}
return 0;
}