![在这里插入图片描述](https://img-blog.csdnimg.cn/20181218193642592.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3poYW5nZ2lybHpoYW5nYm95,size_16,color_FFFFFF,t_70)
代码
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=0; i<n; i++){
string s;
cin>>s;
int count = 0;
for(int j=0; j<s.length(); j++){
if(s.at(j)>='0' && s.at(j)<='9'){
count++;
}
}
cout<<count<<endl;
}
return 0;
}
注解
1、水题。
结果
![在这里插入图片描述](https://img-blog.csdnimg.cn/20181218194014935.png)