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
2017-08-31 02:40:00
just convert char to int by sub it '0' and sum the all digits
2017-08-13 12:17:30
Hello, for c++ , use cstring than cin.getline(),than strlen to read till the end than add sum+=s[i]-'0'
2017-08-12 00:19:17
ez
2017-08-08 13:40:35
Used string and converted each character to an integer and added to the sum..!!
Time limit exceeded for Java Solution..
P.S. Used BigInteger!
2017-07-16 07:00:27
ac in one go..python rocks
2017-06-14 22:29:23
Plz anyone give one example how to use type casting?The one i m applying is not working!!
2017-05-30 19:08:48
time limit exceded :(
using string then convrting each character to int
2017-05-11 10:27:00 hrishabh
ac in one go...do in python
2017-04-27 20:05:32
check the limit i.e 10^50 all newbies
2017-03-16 08:26:12
easy af!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.