/* Name: HDU-2017-字符串统计 Date: 18/04/17 20:19 Description: 水过 */ #include<bits/stdc++.h> using namespace std; int main(){ int n;cin>>n; while(n--){ string str;cin>>str; int ct = 0; for(string::iterator it = str.begin(); it!=str.end(); ++it)if(isdigit((*it)))ct++; cout<<ct<<endl; } return 0; }