ALCATRAZ1 - SUM OF DIGITS

You are being given a number N. (1<=N<=10^50) . You have to print the sum of digits of that particular number. 

Input

The first line will contain T, the number of testcases (T<10) . The next T lines will contain the numbers whose sum of digits you have to calculate .  

Output

Output T lines  containing the Sum of Digits of the numbers .

Example

Input:
3
123123123
3434
1234567890

Output:
18
14
45

Added by:Alcatraz
Date:2016-11-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU

hide comments
2021-03-04 17:49:40
use no. as a string

Last edit: 2021-03-04 17:49:57
2021-01-20 03:19:49
Im using int for the number and the output is correct,why i have WA in SPOJ?
P.S=Sorry for my bad english.
nvm i got it,just use string.

Last edit: 2021-02-11 13:59:40
2020-06-23 11:34:45
Showing success in ideoneit but wrong answer while running judge...
2020-04-02 10:15:09
In java use string to solve by using charAt to get elements from string
2019-11-26 08:13:30
you can solve it using string normally..just calculate the sum of all charecters of the string :)
2019-10-18 07:50:25 vikash
Not for Java or Scala. You will always get TLE .
2019-09-23 10:16:29
Use STL string....
2019-06-16 20:17:05
ac in one go haha sooooooooooo
2019-01-16 16:53:16
AC in one go :)
2018-12-18 02:45:38
java TLE :(
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.