#C5919. Sum of Digits in Sentences

    ID: 49621 Type: Default 1000ms 256MiB

Sum of Digits in Sentences

Sum of Digits in Sentences

You are given several sentences. For each sentence, calculate the sum of all digit characters that appear in it. A digit is any character between '0' and '9'. If a sentence contains no digits, the sum is 0.

For a given sentence \( s \), if it contains digits \( d_1, d_2, \dots, d_k \), the result is computed as:

$$S = \sum_{i=1}^{k} d_i$$

You will be given an integer \( T \) representing the number of sentences. Then \( T \) lines follow, each containing a sentence. Your task is to output the sum for each sentence on a new line.

inputFormat

The first line contains an integer \( T \) (\( 1 \leq T \leq 10^5 \)), representing the number of sentences. The next \( T \) lines each contain a sentence. Each sentence may contain letters, digits, and other printable characters.

outputFormat

Output \( T \) lines, where the \( i^{th} \) line contains the sum of all digits in the \( i^{th} \) sentence. If a sentence contains no digits, output 0 for that sentence.

## sample
1
abc123xyz
6

</p>