#K36037. Sum of Digits Query

    ID: 25665 Type: Default 1000ms 256MiB

Sum of Digits Query

Sum of Digits Query

You are given a list of queries where each query is an integer. For each query, you are required to compute the sum of its digits.

For example, if the query is 123, the sum is 1+2+3=6.

Your task is to read the queries from standard input and print the corresponding sum of digits for each query on a separate line.

Note: The solution must read input from standard input (stdin) and output the answer to standard output (stdout).

inputFormat

The input starts with a single integer Q representing the number of queries. Each of the next Q lines contains one integer.

Input Format:

  • The first line contains an integer Q (1 ≤ Q ≤ 105).
  • Each of the following Q lines contains an integer whose sum of digits needs to be computed.

outputFormat

Output exactly Q lines where each line contains the sum of digits of the corresponding query integer.

Output Format:

  • For each query, print a single integer – the sum of its digits.
## sample
1
123
6

</p>