n = int(input()) for i in range(n): row = input() w=0 for i in row: if i.isdigit(): w+=1 else: w+=0 print(w)