字符串统计:
#include<iostream> #include<cstring> using namespace std; int main(){ char str[1000]; int n; cin>>n; while(n--){ cin>>str; int i,count=0; int length=strlen(str); for(i=0;i<length;++i) if(str[i]<='9'&&str[i]>='0') count++; cout<<count<<endl; } return 0; }