Problem:
Sum of Numbers Write a program which reads an integer and prints sum of its digits. Input The input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 1000. The input ends with a line including single zero. Your program should not process for this terminal symbol. Output For each dataset, print the sum of digits in x . Sample Input 123
55
1000
0 Sample Output 6
10
1

Solution (Python):


import sys
import os


for s in sys.stdin:
    s = s.strip()
    if s == '0':
        break
    else:
        v = 0
        for c in s:
            v += int(c)
        print(v)

Solution (Python):
while True:
    n = int(input())
    if n == 0: break
    nsum = 0
    while n != 0:
        nsum += n%10
        n = n//10
    print(nsum)

Solution (Python):
parent_list = []
while True:
    parent_list.append(input())
    if parent_list[-1] == '0':
        break

for n in parent_list[:-1]:
    sum = 0
    for c in n:
        sum += int(c)
    print(sum)

Solution (Python):
while 1:
    num = input()
    if num == "0":
        break

    a = []
    for i in range(len(num)):
        a.append(int(num[i:i+1]))
    print(sum(a))

Solution (Python):
x = 1
while x != '0':
	x = input()
	if x != '0':
		sum = 0
		for s in x:
			sum += int(s)
		print(sum)

Solution (Python):


 
def func():
    inputdata=[]
    while(True):
        try:
            line=input().rstrip()
            if(int(line)==0):
                break
            else:
                inputdata.append(line)
        except EOFError:
            return 0
        except:
            return inputError()
    
    data=[sum( [int(char) for char in item] ) for item in inputdata]
    [print(item) for item in data]
        
def inputError():
    print("input Error")
    return -1
 
func()

Solution (Python):


numbers = []
sumN = []
while True:
    number = input()
    if number == '0':
        break
    numbers.append(number)
    
for x in numbers:
    value = 0
    for y in x:
        value += int(y)
    sumN.append(value)

for x in sumN:
    print(x)

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x]
    print(sum(num))

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x]
    print(sum(num))

Solution (Python):
while True:
    x = input()
    if x == 0:
        break

    total = 0
    while x != 0:
        total += x % 10
        x = x//10

    print(total)

Solution (Python):
while True:
    n = input()
    if n == "0":
        break
    ans = sum([int(x) for x in n])
    print(ans)

Solution (Python):
from sys import stdin

for l in stdin:
    l = l.rstrip()
    if 0 == int(l):
        break

    print(sum([int(ch) for ch in l]))

Solution (Python):
N = input()
while N != "0":
 SUM = 0
 for i in N:
  SUM += int(i)
 print(SUM)
 N = input()

Solution (Python):
while 1:
    x = input()
    if x == "0":
        break
    kei = 0
    for i in x:
        kei += int(i)
    print(kei)

Solution (Python):
str = input()
while int(str[0]):
    sum = 0
    for char in str:
        sum += int(char)
    print(sum)
    str = input()

Solution (Python):

x=""
while x != "0":
    x = input().rstrip()

    if x =="0":
        break
    
    y = sum(list(map(int , list(x))))
    print(y)

Solution (Python):
while 1:
    s = input()
    if s == '0':break
    print(sum(int(n) for n in s))

Solution (Python):
while True:
    s = input()
    if s == "0":
        break
    nums = list(s)
    goukei = 0
    for i in range(len(nums)):
        goukei += int(nums[i])
    print(goukei)

Solution (Python):
while True:
    num = raw_input()
    if num == "0":
        break
    output = 0
    for i in num:
        output += int(i)
    print output

Solution (Python):
while True:
    l=list(input())
    if l==["0"]:
        break
    print(sum(map(int,l)))

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    sum_x = 0
    for X in x:
        sum_x += int(X)
    print(sum_x)

Solution (Python):
x=1
while True:
    x=list(input())
    x=map(int,x)
    x=sum(x)
    if x==0:
        break
    print(x)

Solution (Python):
x=1
while True:
    x=list(input())
    x=map(int,x)
    x=sum(x)
    if x==0:
        break
    print(x)

Solution (Python):
while True:
    n = sum(map(int, input()))
    if n == 0:
        break
    print(n)

Solution (Python):
while True:
    data = input()
    if data == '0':
        break
    sum = 0
    for c in data:
        sum += int(c)
    print(sum)

Solution (Python):
while 1:
    x=[int(i) for i in input()]
    if sum(x)==0:
        break
    print(sum(x))

Solution (Python):


"""
????????????
"""
while True:
    cnt = 0
    inp = input().strip()
    if int(inp[0]) == 0:
        break
    for i in range(len(inp)):
        cnt += int(inp[i])
    print(cnt)

Solution (Python):
while True:
	data = input()
	if data == '0':
		break
	else:
		data = [int(s) for s in data]
		print(sum(data))

Solution (Python):
while True:
	s = input()
	if s == '0':
		break
	print(sum([int(c) for c in s]))

Solution (Python):
def main():
    N = []
    while True:
        x = input()
        if x == '0':
            break
        else:
            N.append(x)

    for n in N:
        ans = sum(map(int, list(n)))
        print(ans)

main()

Solution (Python):
x = 1
L=[]
n= 0
s=0
while x is not 0:
    x = int(input())
    L.append(x)
N=1
L.remove(0)
for i in L:
    while i >=N:

        N=10*N
        n =i%N
        s+=(n/N*10)
        i-=n
    print (int(s))
    s=0
    N = 1

Solution (Python):
while True:
    s=input()
    if s=="0":
        break
        
    n=list(map(int, list(s)))
    print(sum(n))

Solution (Python):
while True:
  x = sum(map(int, input()))

  if x == 0:
    break

  print(x)

Solution (Python):
while True:
  x=input()
  if x == '0':
   break
  print(sum(int(z) for z in x))

Solution (Python):
while True:
	a = input()
	if a == "0":
		break
	print(sum([int(a[i]) for i in range(len(a))]))

Solution (Python):
list1 = []
while True:
    x = str(input())
    if x == '0':
        break
    else:
        result=0
        for i in x:
            result += int(i)
        list1.append(result)
            
for i in list1:
    print(i)

Solution (Python):
while True:
    string = input()
    if string == "0":break
    print(sum(int(x) for x in string))

Solution (Python):
while True:
    num = input()
    if num == "0":
        break
    print(sum(map(int, list(num))))

Solution (Python):
while True:
    n = input()
    if int(n) == 0:
        break
    else:
        sum = 0
        for i in range(len(n)):
            sum += int(n[i])

        print(sum)

Solution (Python):
a=0

while True:
    z=str(input())
    if z == '0' :
        break
    for i in z:
        k=int(i)
        a+=k
    print(a)
    a=0

Solution (Python):
while True:
    x = input()
    if int(x) == 0:break
    ret = 0
    for a in x:
        ret += int(a)
    print(ret)

Solution (Python):
x = input()
while 1:
    sum_x = 0
    if x == "0":
        break
    for c in x:
        sum_x += int(c)
    print(sum_x)
    x = input()

Solution (Python):
xin = []
while True:
    x = int(raw_input())
    if x == 0:
        break
    xin += [x]
for i in xin:
    print sum(map(int , list(str(i))))

Solution (Python):
xin = []
while True:
    x = raw_input()
    if x == '0':
        break
    xin += [x]
for i in xin:
    print sum(map(int , list(i)))

Solution (Python):
xin = []
while True:
    x = raw_input()
    if x == '0':
        break
    
    print sum(map(int , list(x)))

Solution (Python):
xin = []
while True:
    x = raw_input()
    if x == '0':
        break
    
    print sum(map(int , list(x)))

Solution (Python):
while True:
    x = raw_input()
    if x == '0':
        break
    print sum(map(int , list(x)))

Solution (Python):
while True:
    x = raw_input()
    if x == '0':
        break
    print sum(map(int , list(x)))

Solution (Python):
while(1):
	num = list(map(int,input()))
	
	if num[0] == 0:
		break
	print(sum(num[:]))

Solution (Python):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def digit_sum(n):
    s = 0
    while n > 0:
        s += n % 10
        n //= 10
    return s


while True:
    n = int(input())
    if n == 0:
        break
    print(digit_sum(n))

Solution (Python):
while True:
    z=list(map(int,(list(str(input())))))
    if z[0]==0:
        break
    print(sum(z))

Solution (Python):
while True:
    z=list(map(int,(list(str(input())))))
    if z[0]==0:
        break
    print(sum(z))

Solution (Python):
while True:
    i = list(map(int,list(input())))
    if i == [0]:
        break
    else:
        print(sum(i))

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    sum_s = 0
    for s in x:
        sum_s += int(s)
    print(sum_s)

Solution (Python):
while True:
   x=input()
   if x=="0":
       break
   cnt = 0
   for i in x:
       num = int(i)
       cnt += num
   print(cnt)

Solution (Python):
while(True):
    a = input()
    if(a == '0'):
        break
    b = [int(i) for i in list(str(a))]
    print(sum(b))

Solution (Python):
n = input()

while n != "0":
	sum = 0
	for i in n:
		sum += int(i)
	print(sum)
	n = input()

Solution (Python):
Nsum = 0

while True:
    I = input()
    if int(I) == 0:
        break
    for i in I:
        Nsum += int(i)
    print(Nsum)
    Nsum = 0

Solution (Python):


while True:
    strnum = input().rstrip()
    if strnum == "0":
        break
    answer = sum(map(int, strnum))
    print(answer)

Solution (Python):
x = str(input())
while x != "0":
    ans = 0
    for i in list(x):
        ans += int(i)
    print(ans)
    x = str(input())

Solution (Python):
while True:
    numbers = [int(i) for i in  list(input())]
    if len(numbers) == 1 and numbers[0] == 0:
        break
    print(sum(numbers))

Solution (Python):
def f(s):
    return sum(map(int, s))

while True:
    s = input()
    if s == "0":
        break

    print(f(s))

Solution (Python):
while True:
    n=sum(list(map(int, list(input()))))
    if n == 0:
        break
    print(n)

Solution (Python):
sum_list=[]
while True:
    num=input()
    if num=='0':
        break
    num_list=list(num)
    for i in range(0,len(num_list)):
        num_list[i]=int(num_list[i])
    sum_list.append(sum(num_list))

for i in sum_list:
    print(i)

Solution (Python):
while True:
    x = int(input())
    if x == 0:
        break
    sum = 0
    while x != 0:
        sum += x%10
        x = x//10

    print(sum)

Solution (Python):
n = int(input())
res = 0
while n != 0:
 res = n%10
 dropped = n
 while dropped//10 != 0:
  dropped = dropped//10
  res += dropped%10
 print(res)
 res = 0
 n = int(input())

Solution (Python):
while True:
    s = input()
    if s == '0':
        break
    print(sum((map(int, s))))

Solution (Python):
while True:
    s = raw_input()
    if s == "0":
        break
    print sum([int(i) for i in s])

Solution (Python):
while True:
    l = list(input())
    if l == ['0']:
        break
    print(sum(map(int, l)))

Solution (Python):
l = list(map(int, input()))
while l[0]:
    print(sum(l))
    l = list(map(int, input()))

Solution (Python):
while True:
    n = list(input())
    if n[0] == '0':
        break
    sum = 0
    for i in n:
        sum += int(i)
    print(sum)

Solution (Python):
while True:
    n = input()
    if n == '0':
        break
    sum = 0
    for i in n:
        sum += int(i)
    print(sum)

Solution (Python):
while True:
    n = [int(x) for x in input()]
    if n[0] == 0:
        break
    print(sum(n))

Solution (Python):
while True:
    n = [int(x) for x in input()]
    if n[0] == 0:
        break
    print(sum(n))

Solution (Python):
while True:
    n = [int(x) for x in input()]
    if n[0] == 0:
        break
    print(sum(n))

Solution (Python):
while True:
    n = [int(x) for x in input()]
    if n[0] == 0:
        break
    print(sum(n))

Solution (Python):
while True:
	strnum = raw_input().strip()
	if strnum == "0":
		break
	else:
		wa = 0
		for c in strnum:
			wa += int(c)
		print wa

Solution (Python):
import sys
def main():
    for x in sys.stdin:
        if x == "0\n":
            break
        else:
            X = list(x)
            total = 0
            for i in range(len(X) - 1):
                total += int(X[i])
            print(total)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
while True:
    n=0
    s=sys.stdin.readline()
    if s=='0\n': break
    for i in range(len(s)-1):
        n+=int(s[i])
    print(n)

Solution (Python):
def main():

    while True:
        number_string = input()
        if number_string == '0': break
        print(sum(map(int, list(number_string))))
    
main()

Solution (Python):
while True:
    line = input()
    if line == '0':
        break

    n = 0
    for c in line:
        n += int(c)
    print(n)

Solution (Python):

"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        x = int(input())
        if x == 0:
            break

        digit_sum = 0
        while x:
            digit_sum += x % 10
            x //= 10
        print(digit_sum)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
r = []
while True:
    line = input()
    if line == '0':
        break
    r.append(sum([int(s) for s in line]))

for s in r:
    print(s)

Solution (Python):

while(1):
	n = str(input())
	
	if n != '0':
		ans = 0
		for x in n:
			ans += int(x)
		print(ans)
	else:
		break

Solution (Python):
while 1:
    x=sum(map(int,list(input())))
    if x==0:break
    print(x)

Solution (Python):


def main():

    while True:
        inputNumber = input()
        if(inputNumber == '0'):
            break
        else:
            print(sum(list(map(int, inputNumber))))

if __name__ == '__main__':
    main()

Solution (Python):
a=[]
w=1
while(w!=0):
    w=int(input())
    a.append(w)
a.pop()
for i in a:
    s=0
    for j in range(len(str(i))):
       s+=int(str(i)[j])
    print("{0}".format(s))

Solution (Python):
def main():
    while True:
        s = input()

        if s == "0":
            break

        print(sum(map(int, list(s))))

if __name__ == "__main__":
    main()

Solution (Python):
while 1:
 a=input()
 if a=='0':break
 print(sum([int(s) for s in list(a)]))

Solution (Python):
while 1:
 a=input()
 if a=='0':break
 print(sum([int(s)for s in a]))

Solution (Python):
'''
Input   Output
123     6
55      10
1000    1
0
'''
for str in iter(input, "0"):
 print(sum([int(c) for c in str]))

Solution (Python):
while 1:
    x=sum(map(int,list(input())))
    if x==0:break
    print(x)

Solution (Python):
while 1:
 x=sum(map(int,list(input())))
 if x==0:break
 print(x)

Solution (Python):
for a in iter(input,'0'):
 print(sum([int(s)for s in a]))

Solution (Python):
while True:
    s = sum([int(i) for i in list(input())])
    if s:
        print(s)
    else:
        break

Solution (Python):
a = []
while True:
    n = int(input())
    if n == 0:
        break
    a.append(n)

for i in range(len(a)):
    b = list(str(a[i]))
    sum = 0
    for j in b:
        sum += int(j)
    print(sum)

Solution (Python):
a = []
while True:
    n = int(input())
    if n == 0:
        break
    a.append(n)

for i in range(len(a)):
    b = list(str(a[i]))
    sum = 0
    for j in b:
        sum += int(j)
    print(sum)

Solution (Python):
while True:
    num=input()
    if num=="0":
        break
    total=0
    for i in num:
        total+=int(i)
    print(total)

Solution (Python):
while True:
    numbers = list(map(int,input()))
    if numbers[0] == 0:
        break
    print(sum(numbers))

Solution (Python):
while True:
  x=input()
  if x=='0':
    break 
  print(sum(int(i) for i in x))

Solution (Python):
while 1:
    s=input();n=0
    if s=="0":
        break
    for i in range(len(s)):
        n+=int(s[i])
    print(n)

Solution (Python):
while True:
    instr = input()

    if instr == '0':
        break

    total = 0
    for s in instr:
        total += int(s)

    print(total)

Solution (Python):
while True:
    s = input()
    if s == "0":
        break
    print(sum(map(int, list(s))))

Solution (Python):
result = []
while 1:
    n = int(input())
    if n == 0:
        break
    ans = 0
    for i in range(1,1001):
        ans += n // pow(10,1000-i)
        n = n % pow(10,1000-i)
    result.append(ans)

for i in range(len(result)):
    print(result[i])

Solution (Python):
while 1:
    a = [int(x) for x in input()]
    if len(a) and a[0] == 0:
        break
    print(sum(a))

Solution (Python):
while True:

    x = input()

    if x == '0':
        break

    length = len(x)
    tot = 0

    for i in range(length):
        tot += int(x[i:i + 1])
    print(tot)

Solution (Python):

while True:
    array = map(int, list(raw_input()))
    if array[0] == 0:
        break
    print sum(array)

Solution (Python):
while True :
    N = sum(map(int, input()))
    if N == 0 :
        break    
    print(N)

Solution (Python):
while True:
    n = int(input())

    if n == 0:
        break
    else:
        sum = 0

        while n > 0:
            sum += n % 10
            n //= 10

        print(sum)

Solution (Python):

num_list = []
while(1):
    num = [map(int,raw_input())]
    if num[0][0] == 0:
        break
    num_list.extend(num)
for i in range(len(num_list)):
    print sum(num_list[i])

Solution (Python):
for a in iter(input,'0'):print(sum([int(s)for s in a]))

Solution (Python):
while True:
    x = input()
    if x == '0':
        break
    print (sum([int(t) for t in x]))

Solution (Python):
while(True):
    num_in = list(map(int, [i for i in input()]))
    if(num_in[0]==0):
        break
    else:
        print(sum(num_in))

Solution (Python):
from sys import stdin
for line in stdin:
    if line == '0\n':
        break
    num = list(map(int, line.strip('\n')))
    print(sum(num))

Solution (Python):
while True:
    a = input()
    if a == '0':
        break
    print(sum(list(map(int,a))))

Solution (Python):
while True:
  x = input().rstrip('\r\n')
  if x == '0':
    break

  sum = 0

  for ii in range(len(x)):
    sum += int(x[ii])
  print(sum)

Solution (Python):



import sys

while True:
    s = sys.stdin.readline().strip()
    if s == '0':
        break
    total = 0
    for c in s:
        total += int(c)
    print(total)

Solution (Python):
while True:
    inp = input()
    if inp == '0':
        break
    ans = 0
    for i in inp:
        ans += int(i)
    print(ans)

Solution (Python):
while True:
  x = sum(map(int, input()))
 
  if x == 0:
    break
 
  print(x)

Solution (Python):
number = input()
length = len(number)

while number != "0":
	i = 0
	sum = 0
	while i < length:
		sum += int(number[i])
		i += 1
	print(sum)
	number = input()
	length = len(number)

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    x = list(map(int, list(x)))
    print(sum(x))

Solution (Python):
while True:
    input = raw_input()
    if input == '0': break
    num = map(int, input)
    print sum(num)

Solution (Python):
while True:
    input = raw_input()
    if input == '0': break
    print sum(map(int, input))

Solution (Python):
while(True):
    num = input()
    if num == '0':
        break
    x = 0
    for i in num:
        x += int(i)
    print(x)

Solution (Python):
while True :
    n = input()
    if n == '0' : break
    print(sum(map(int, n)))

Solution (Python):
import functools


def sum_of_digits(digits):
    """culculate the sum of each digit of 'digits'

    >>> sum_of_digits("123")
    6
    >>> sum_of_digits("100")
    1
    >>> sum_of_digits("")
    0
    """
    return functools.reduce(lambda x, y: x+int(y), digits, 0)


def run():
    d = input()

    while d != '0':
        print(sum_of_digits(d))
        d = input()


if __name__ == '__main__':
    run()

Solution (Python):
while True:
    val = input()
    if val == "0":
        break

    numList = list(map(int, list(val)))
    sum = 0
    for i in range(len(numList)):
        sum += int(numList[i])

    print(sum)

Solution (Python):
ans = ''
while True:
    s = int(input())
    if s == 0:
        break
    else:
        x = 0
        while s != 0:
            x += s % 10
            s = s // 10
        ans += str(x) + '\n'
if ans != '':
    print(ans[:-1])

Solution (Python):
while True:
    sum = 0
    x = int(input())
    if x == 0:
        break
    else:
        while x > 0:
            sum += x % 10
            x //= 10
        print(sum)

Solution (Python):


while True:
    x = input()
    if x == '0':
        break

    s = 0
    for i in range(len(x)):
        s += int(x[i])
    print(s)

Solution (Python):
while 1:
  l = [int(x) for x in list(input())]
  if 0 in l and len(l) == 1: break
  print(sum(l))

Solution (Python):
import sys

l = []
for i in sys.stdin:
    l.append(i)

for i in range(0,len(l)):
    if int(l[i]) == 0:
        break
    count = 0
    for j in range(0,len(l[i])-1):
        count += int(l[i][j])
    print(count)

Solution (Python):
X = []
while True:
    x = raw_input()
    if x == "0":
        break
    else:
        X.append(x)

ans = []
for i in range(len(X)):
    tmp = 0
    for j in range(len(X[i])):
        tmp+=int(X[i][j])
    ans.append(tmp)

for char in ans:
    print char

Solution (Python):
result = []

while True:
    first_input = int(input())
    if first_input == 0:
        break

    result.append(sum(list(map(int, str(first_input)))))

print(*result, sep='\n')

Solution (Python):
X = []
while(True):
    x = input()
    if x =="0":
        break
    else:
        X.append(x)
for i in range(len(X)):
    x_sum = 0
    for j in X[i]:
        x_sum += int(j)
    print(x_sum)

Solution (Python):
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))

Solution (Python):


while True:
    n = int(input())
    if n == 0:
        break
    l = [int(x) for x in list(str(n))]
    print(sum(l))

Solution (Python):
while True:
    X = input()
    if X == "0":
        break
    num = sum([int(x) for x in X])
    print(str(num))

Solution (Python):
while True:
    x = str(input())
    if x == '0':
        break
    num = list(x)
    num2 = list(map(int, num))
    print(sum(num2))

Solution (Python):
x = str(input())
while x != '0':
    num2 = list(map(int, list(x)))
    print(sum(num2))
    x = str(input())

Solution (Python):
line = ""

while line != "0":
	line = input()
	x = 0
	for i in range(len(line)):
		x += int(line[i])
	if x != 0:
		print(x)

Solution (Python):



while True:
    x = input()
    if x == '0': break

    sum = 0
    for c in x:
        sum += int(c)
    print(sum)

Solution (Python):
for a in iter(input,'0'):print(sum(int(s)for s in a))

Solution (Python):
while True:
	sum = 0
	A = input()
	if int(A) == 0 : break
	for i in range(len(A)):
		sum += int(A[i])
	print(sum)

Solution (Python):
while True:
    s = input()
    if s == '0':
        break
    print(sum(list(map(int, s))))

Solution (Python):
def SoN(x):
	ans = 0
	while 1:
		if x<10:
			ans += x
			return ans
		else:
			ans += x % 10
			x //= 10

while 1:
	x = int(input())
	if x==0:
		break
	print(SoN(x))

Solution (Python):
while True :
    num = map(int,input())
    s   = sum(num)
    if s == 0: break
    else:
        print(s)

Solution (Python):
Ans=[]
while True:
    l=list(input())
    if l==["0"]:
        break
    else:
        su=0
        for s in l:
            su+=int(s)
        Ans.append(su)
for a in Ans:
    print(a)

Solution (Python):
while True:
    x=input()
    if x=='0':
        break
    print(sum(int(s) for s in x))

Solution (Python):
while True:
    x = raw_input()
    if x == "0":
        break
    print("%d" % (sum(map(int, x)), ))

Solution (Python):
while True:
    n=input()
    if n=='0':
        break
    s=list(n)
    a=[int(i) for i in s]
    print(sum(a))

Solution (Python):
while 1:
    n = input()
    if n == '0':
        break
    nl = list(map(int,list(n)))
    print(sum(nl))

Solution (Python):
while True:
    n = input()
    if n == "0": break
    print(sum([int(i) for i in n]))

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    print(sum([int(_) for _ in list(x)]))

Solution (Python):
while True:
    x = input()
    if x == "0":
        break
    print(sum([int(_) for _ in list(x)]))

Solution (Python):
while True:
    n = input()
    if n == '0':
        break

    sum_digit = 0
    for c in n:
        sum_digit += int(c)

    print(sum_digit)

Solution (Python):


def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        n = int(input())
        if n == 0: break
        sum = 0
        while n > 0:
            sum += n % 10
            n = n // 10
        print(sum)

if __name__ == "__main__":
    main()

Solution (Python):
while 1:
    a = sum(map(int, input()))
    if a == 0:
        break
    else:
        print(a)

Solution (Python):
while True:
    total = 0
    x = input()
    if x == "0": break
    for c in x:
        total += int(c)
    print(total)

Solution (Python):

while True:
	s = str(input())
	if s == '0': break

	ans = 0
	for c in s:
		ans += int(c)
	print(ans)

Solution (Python):
while True:
    x = input()
    if x == '0':
        break
    print(sum([int(x[i]) for i in range(len(x))]))

Solution (Python):
while True:
    A = 0
    a = list(input())
    if a == ["0"]:
        break
    for x in a:
        A += int(x)
    print(A)

Solution (Python):
import sys


for line in sys.stdin :
    if int(line.strip()) == 0 :
        break
    s = line.strip()
    sum = 0
    for c in s :
        sum += int(c)
    print(sum)

Solution (Python):


end = 0
while end == 0:
    number = list(input())
    if number == ["0"]:
        end += 1
    else:
        
        digitTotal = 0
        for digit in number:
            digitTotal += int(digit)
        print(digitTotal)

Solution (Python):
while True:
    n = int(input())
    if(n == 0):
        break
    i = n%10
    x = n//10
    while(x):
        i = i + (x%10)
        x //= 10
    print(i)

Solution (Python):
while True:
    number = input()
    x = 0
    if number != '0':
        for i in number:
            x += int(i)
        print(x)
    else:
        break

Solution (Python):
if __name__ == "__main__":
    input_num = input()
    while input_num != "0":
        sum_of_digits = 0
        for d in input_num:
            sum_of_digits = sum_of_digits + int(d)
        print(sum_of_digits)
        input_num = input()

Solution (Python):
while True:
	x = sum(map(int, input()))
	if x == 0:
		break
	print(x)

Solution (Python):
while True:
    a=list(input())
    if a[0]=='0':
        break
    g=0
    for i in a:
        g+=int(i)
    print(g)

Solution (Python):
while True:
    x = raw_input()
    if x == "0":
        break
    print("%d" % (sum(map(int, x)), ))

Solution (Python):
import sys

for line in sys.stdin:
    if int(line) == 0: break
    s = 0
    for c in line.strip('\n'):
        s += '0123456789'.index(c)
    print s

Solution (Python):
while True:
    x = raw_input()
    if x == '0':break
    print sum(['0123456789'.index(c) for c in x])

Solution (Python):
while 1:
    x=raw_input()
    if x=='0': break
    print sum([int(v) for v in x])

Solution (Python):
while 1:
        T=raw_input()
        if T=="0":
                break
        t=list(T)
        s=0
        for i in range(len(t)):
                s+=int(t[i])
        print s

Solution (Python):
from __future__ import division, print_function
from sys import stdin
for line in stdin:
    if line.startswith('0'):
        break
    print(sum(int(c) for c in line.rstrip()))

Solution (Python):
while True:
    n=list((raw_input()))

    if int(n[0]) == 0:
        break
    else:
        x=0
        for i in xrange(len(n)):
            x+=int(n[i])
    print x

Solution (Python):
while True:
	s = raw_input()
	if s == '0':
		break
	n = 0
	for i in s:
		n += int(i)
	print n

Solution (Python):
while True:
    x = raw_input()
    if x == "0":
        break
    sum = 0
    for i in x:
        sum += int(i)
    print sum

Solution (Python):
while True:
    x = raw_input()
    if x == "0":
        break
    print sum(map(int,x))

Solution (Python):
while 1:
    numbers = [i for i in raw_input()]
    if numbers[0] == '0': break
    print sum(map(int,numbers))

Solution (Python):
while True:
    x = str(raw_input())
    if int(x) == 0:
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print sum

Solution (Python):
while True:
    x = str(raw_input())
    if int(x) == 0:
        break
    sum = 0
    for i in range(len(x)):
        sum += int(x[i])
    print sum

Solution (Python):
while True:
	n = input()
	if n == 0: break
	print sum(map(int, list(str(n))))

Solution (Python):
while 1:
    n = raw_input()
    if n == '0': break;
    print reduce(lambda x,y: x+int(y), n, 0)

Solution (Python):
while 1:
    x = raw_input()
    if x == '0': break;
    print sum([int(d) for d in x])

Solution (Python):
while 1:
    x = raw_input()
    if x == '0': break;
    print sum(int(s) for s in x)

Solution (Python):
while True:
    s = input()
    if s == '0': break
    print(sum(int(c) for c in s))

Solution (Python):
while True:
 sum=0
 str=raw_input()
 if str=="0":break
 for i in range(0,len(str)):
  sum+=int(str[i])
 print sum

Solution (Python):
while True:
    lst = [int(x) for x in str(input())]
    if lst == [0]:
        break
    print(sum(lst))

Solution (Python):
ans_list = []
while True:
    x = input()
    if x == "0":
        break
    sum = 0
    for i in x:
        sum += int(i)
    ans_list.append(sum)
for ans in ans_list:
    print(ans)

Solution (Python):
while True:
    a = str(input())
    if a == "0":
        break
    tmp = 0
    for i in a:
        tmp += int(i)
    print(tmp)

Solution (Python):
data=[]
while True:
    string=input()
    if string=='0':
        break
    hen=(list(string))
    data.append(sum([int(s) for s in hen]))


for i in range(len(data)):
    print(data[i])

Solution (Python):
while True:
    s = input()
    if s == '0':
        break
    print(sum(list(map(int, s))))

Solution (Python):
sum=0

while True:
    a=input()
    
    if a=='0':
        break
    
    for i in range(len(a)):
        sum +=int(a[i])
    
    
    print(sum)
    sum=0

Solution (Python):
while True:
    a = str(input())
    if a == "0":
        break
    b = 0
    for i in a:
        b=b+int(i)
    print(b)

Solution (Python):
while 1:
    n=input()
    if n=='0':break
    print(sum(int(x) for x in n))

Solution (Python):
while True:
    x=int(input())
    if x==0:break
    sum=0
    while x>=1:
        sum += x%10
        x=x//10
    print(sum)

Solution (Python):
while True:
    str_n=input()
    if str_n=="0":
        break
    list_n=list(str_n)
    ans=0
    for n in list_n:
        ans+=int(n)
    print(ans)

Solution (Python):
while True:
	x=input()
	if x=='0': break
	print(sum(list(map(int,list(x)))))

Solution (Python):
s=[]
while True:
    tmp=input()
    if tmp=="0":
        break
    else:
        s.append([int(x) for x in list(tmp)])

for i in range(len(s)):
    cnt=0
    for j in range(len(s[i])):
        cnt+=s[i][j]
    print(cnt)

Solution (Python):
def digitsum(n):
    s=str(n)
    array=list(map(int,s))
    return sum(array)
    
while True:
    n=int(input())
    if n == 0:
        break
    else:
        print(digitsum(n))

Solution (Python):
x=int(input())
while x!=0:
    
    list=[]
    while x>0:
        list.append(x%10)
        x=x//10
    print(sum(list))
    
    x=int(input())