代码(C++)
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void sta(vector<string> temp) {
int num;
for (int i = 0; i < temp.size(); ++i) {
num = 0;
for (int j = 0; temp[i][j] != '\0'; ++j) {
if (temp[i][j] - '0' >= 0 && temp[i][j] - '0' <= 9) {
++num;
}
}
cout << num << endl;
}
}
int main() {
/*[输入]
2
asdfasdf123123asdfasdf
asdf111111111asdfasdfasdf
*/
int n;
vector<string> temp;
cin >> n;
while (n) {
string str;
cin >> str;
temp.push_back(str);
--n;
}
sta(temp);
return 0;
}