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):
def main():

    while True:
        num = input()
        if num == '0':
            break
        else:
            count = 0
            for s in num:
                count += int(s)
            print(count)

if __name__ == '__main__':
    main()

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

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

        if num == "0":
            break

        print(sum([int(x) for x in num]))

if __name__ == '__main__':
    main()

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

Solution (Python):
while True:
    kazu = [int(x) for x in input()]
    if kazu == [0]:
        break
    else:
        print('{}'.format(sum(kazu)))

Solution (Python):
x = input()
while x != '0':
    x_nums = sum([int(i) for i in x[:]])
    print(x_nums)
    x = input()

Solution (Python):

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

Solution (Python):
b = []
while True:
    a = input()
    k = 0
    if a != "0":
        for i in range(len(a)):
            k += int(a[i])
        b.append(k)
    else:
        break
for i in range(len(b)):
    print(b[i])

Solution (Python):
values = []
while True:
    value = input()
    if value == "0":
        break
    else:
        values.append(value)

for value in values:
    summation = 0
    for i in range(len(value)):
        summation += int(value[i])
    print(summation)

Solution (Python):
x = input()
while x!= "0":
    sum = 0;
    for i in range(len(x)):
        sum += int(x[i])
    print(sum)
    x = input()

Solution (Python):
while True:
    s = input()
    if s == "0":
        break
    a = 0
    for i,j in enumerate(s):
        a += int(s[i])
    print(a)

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

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

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

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

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

Solution (Python):
lst=[]
while True:
    lst.append(input())
    if "0" in lst:
        break
lst=lst[:-1]
for i in lst:
    sum=0
    for j in range(len(i)):
        sum+=int(i[j])
    print(sum)

Solution (Python):
readline = open(0).readline
write = open(1, 'w').write
while 1:
    x = readline()
    if x == "0\n":
        break
    write("%d\n" % sum(map(int, x.strip())))

Solution (Python):
a = True
while a:
    l = list(map(int, list(input())))
    if l[0] != 0:
        print(sum(l))
    else:
        a = False

Solution (Python):
while True:
    
    num = int(input())
    
    if num == 0:
        break
    box = []
    while num != 0:
        box.append(num%10)
        num = num//10
        
    print(sum(box))

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

Solution (Python):
while True:
    x = int(input())
    if x == 0:
        break
    SCORE = len(str(x))
    ans = 0
    amari=x
    for i in range(SCORE+1):
        ans += amari//10**(SCORE-i)
        amari = amari%10**(SCORE-i)
    print(ans)

Solution (Python):
from sys import stdin

while True:
    x = [int(i) for i in list(stdin.readline().rstrip())]
    if len(x) == 1 and x[0] == 0:
        break
    else:
        print(sum(x))

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

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

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

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

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

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

Solution (Python):
while True:

	num = input()
	if num == "0":
		break
	else:
		k = 0
		for j in num:
			k += int(j)
		print(k)

Solution (Python):
table = []
i = 0
while True:
  table.append(int(input()))
  if table[i] == 0:
    break
  i += 1

for num in table:
  if num == 0:
    break
  sum = 0
  i = 0
  while num != 0: 
    sum += num % 10
    num //= 10
    if num == 0:
      break
  print(sum)

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

Solution (Python):


while True:
    buf = list(input())
    if len(buf) == 1 and int(buf[0]) == 0:
        break
    else:
        ans = 0
        for i in range(len(buf)):
            ans += int(buf[i])
        print(ans)

Solution (Python):


while True:
    buf = list(input())
    if len(buf) == 1 and int(buf[0]) == 0:
        break
    else:
        ans = 0
        for i in range(len(buf)):
            ans += int(buf[i])
        print(ans)

Solution (Python):
while 1:
    a = int(input())
    if a == 0:
        break
    b = sum(a%10**(i+1)//10**i for i in range(1000) if a%10**i != a)
    print(b)

Solution (Python):
while 1:
    a = int(input())
    if a == 0:
        break
    b = sum(a%10**(i+1)//10**i for i in range(1000) if a%10**i != a)
    print(b)

Solution (Python):
while 1:
    a = int(input())
    if a == 0:
        break
    b = sum(a%10**(i+1)//10**i for i in range(1000) if a%10**i != a)
    print(b)

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

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

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

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

Solution (Python):
go = 1
while go == 1:
    a = str(input())
    alist = list(a)
    if a == "0":
        go = 0
        exit
    sum = 0
    for i in alist:
        i = int(i)
        sum += i
    if go == 1:
        print(sum)

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

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

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

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

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

Solution (Python):
while True:
    d = raw_input()
    s = 0
    if int(d) == 0:
        break
    for c in d:
        v = ord(c) - ord('0')
        s = s + v
    print s

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

Solution (Python):
a = list()
while True:
    a.append(sum(list(map(lambda x: int(x), list(input())))))
    if a[-1] == 0:
        break
for a_ in a[:-1]:
    print(a_)

Solution (Python):
while 1:
	a = raw_input()
	if a =='0':
		break
	sum = 0
	for i in a:
		sum += int(i)
	print sum

Solution (Python):
while 1:
    n,a=raw_input(),0
    for i in n:a+=int(i)
    if a:print a
    else:break

Solution (Python):
s = raw_input()
while s != "0":
	sum = int(s[0])
	for i in range(1,len(s)):
		sum += int(s[i])
	print sum
	s = raw_input()

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

Solution (Python):
while True:
    numlist = raw_input()
    
    if numlist[0]=="0":
        break

    s = 0
    for num in numlist:
        s+=int(num)

    print s

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

Solution (Python):
sum = [] 

while True:
    text = input()

    if text == '0':
        break

    tmp = 0
    for i in range(len(text)):
       tmp += int(text[i]) 
    sum.append(tmp)

for r in sum:
    print(r)

Solution (Python):
import sys

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

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

    total = 0
    for a in range(len(text)):
        total += int(text[a])

    print(total)

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

Solution (Python):
import sys
from functools import reduce
for line in sys.stdin:
    if int(line) == 0:
        break
    s = reduce(lambda a,b: int(a)+int(b), line.strip())
    print(s)

Solution (Python):
while True:
    try:
        x = raw_input()
        if x == '0':
            break
    except EOFError:
        break
    
    tot = 0
    for s in x:
        tot += int(s)
    print tot

Solution (Python):
def solve(x):
    return sum([int(i) for i in str(x)])

if __name__ == '__main__':
    while True:
        x = int(input())
        if x == 0: break
        print(solve(x))

Solution (Python):


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

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

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

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Solution (Python):
import sys

while True:
	line = sys.stdin.readline().rstrip()
	t = sum( [ int( line[i] ) for i in range( len( line ) ) ] )
	if 0 == t:
		break
	else:
		print( t )

Solution (Python):
import sys

while True:
	line = sys.stdin.readline().rstrip()
	t = sum( [ int( line[i] ) for i in range( len( line ) ) ] )
	if 0 == t:
		break
	else:
		print( t )

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

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

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

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

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

    print sum

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

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

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

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

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

Solution (Python):
import sys

for i in sys.stdin:
    if int(i) == 0:
        break
    print(sum(map(int, i.rstrip())))

Solution (Python):
data = []
while True:
    in_line = raw_input()
    if int(in_line) == 0:
        break
    sum = 0
    for s in in_line:
        sum += int(s)
    data.append(sum)
for d in data:
    print d

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

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

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

Solution (Python):
while True:
    n = raw_input()
    if n=="0":
        break
    ans = 0
    for x in xrange(len(n)):
        ans += int(n[x])
    print ans

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

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

Solution (Python):


import sys

ans = []
while ( 1 ):
    
    strings = input()
    if (len(strings) == 1 and int(strings[0]) == 0):
        break
    
    ans = 0
    for s in strings:
        ans += int(s)
    print(ans)

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

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

Solution (Python):
num = []
ans = []
while True:
    num = map(int,raw_input())
    if num == list([0]):
        break
    ans.append(sum(num))

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

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

Solution (Python):
import sys
for i in sys.stdin:
    if int(i) == 0:
        break
    print(sum(map(int, i.rstrip())))

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):
for str in iter(input, "0"):
  print(sum(int(c) for c in str))

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

Solution (Python):
num_list=[]
while True:
    num = input()
    if num == 0:
        break
    num_list.append(num)

for num in num_list:
    print sum(map(int,list(str(num))))

Solution (Python):


while True:
    n = int(raw_input())
    if n == 0:
        break
    else:
        sum = 0
        while n > 0:
            sum += n%10
            n /= 10
        print sum

Solution (Python):
while True:
    letters = input()
    if letters == '0':
        break
    sumed = 0
    for letter in letters:
        sumed += int(letter)
    print(sumed)

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

Solution (Python):
while(True):
    s = str(input())
    if(s == '0'): break
    ans = 0
    for i in range(len(s)):
        ans += int(s[i])
    print(ans)

Solution (Python):
while 1:
	x = raw_input()
	if x == '0':
		break
	s = 0
	for i in xrange(len(x)):
		s += int(x[i])
	print s

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

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

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

Solution (Python):

while 1:
    
    input_num = list(input())
    
    if int(input_num[0]) == 0:
        break
    
    
    digitTotal = 0
    for i in range(0, len(input_num)):
        digitTotal += int(input_num[i])
    print("{0}".format(digitTotal))

Solution (Python):






















data=[]

while 1:
	temp = int( input() )
	if temp==0:
		break;
	else:
		data.append( temp )

for i in range( len(data) ):
	num = list( map(int, list( str( data[i] ) ) ) )
	print( sum(num) )

Solution (Python):
x = input()

while x !='0':
    x_list = list(x)
    
    
    sum = 0
    for i in range(len(x_list)):
        sum += int(x_list[i])
    print(sum)    
    x = input()

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

Solution (Python):
x = input()

while x != '0':
    x_list = list(x)
    
    
    sum = 0
    for i in range(len(x_list)):
        sum += int(x_list[i])
    print(sum)
    x = input()

Solution (Python):
x = input()

while x != '0':
    x_list = list(x)
    
    
    sum = 0
    for i in range(len(x_list)):
        sum += int(x_list[i])
    print(sum)
    x = input()

Solution (Python):

while 1:
    
    input_num = list(input())
    
    if int(input_num[0]) == 0:
        break
    
    
    digit_total = 0
    for i in range(0, len(input_num)):
        digit_total += int(input_num[i])
    print("{0}".format(digit_total))

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

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

Solution (Python):
import sys
import math

while 1:
    n = input()

    if (n == 0):
        break

    ret = 0

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

    print ret

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

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

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

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

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

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

	sum = 0
	for num in list(num_str):
		sum += int(num)
	print(sum)

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

Solution (Python):
x = int(input())
while x:
    s = 0
    while x:
        s += x%10
        x//=10
    print (s)
    x = int(input())

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

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

    print(sum([int(i) for i in data]))

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

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

    print(sum([int(i) for i in data]))

Solution (Python):
while True:
    data = input()
    if data[0] == '0':
        break

    print(sum([int(i) for i in data]))

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

Solution (Python):
while True:
    data = input()
    if data[0] == '0':
        break

    print(sum([int(i) for i in data]))

Solution (Python):
while True:
    data = input()
    if data[0] == '0':
        break

    print(sum([int(i) for i in data]))

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

    sum = 0
    while data > 0:
        sum += data % 10
        data //= 10
    print(sum)

Solution (Python):
for str in iter(input, "0"):
  print(sum(int(c) for c in str))

Solution (Python):
while True:
    data = input()
    if data[0] == '0':
        break

    print(sum([int(i) for i in data]))

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

Solution (Python):


import sys

a = sys.stdin.readlines()

for j in a:
	b = []
	for i in j.rstrip('\n'):
		b.append(int(i))
	if sum(b) == 0:
		break
	else:
		print sum(b)

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

    if data[0]=='0':
        break
    print(sum([int(i)for i in data]))

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

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

    print(sum([int(i) for i in data]))

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

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

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

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

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

    if data[0] == '0':
        break
    print(sum([int(i) for i in data]))

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

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

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

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

Solution (Python):

while True:
 s = raw_input()
 if s=="0": break
 t = 0
 for n in s:
  t += int(n)
 print t

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

Solution (Python):
num = int(input())
while num != 0:
    sum = 0
    k = 1
    while num>=k:
        sum = sum + num%(k*10)//k
        k = k*10
    print(sum)
    num = int(input())

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

Solution (Python):
sum = 0
while(1):
    num = raw_input()
    if num == '0':
        break
    else:
        for i in range(len(num)):
            sum += int(num[i])
    print sum
    sum = 0

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

Solution (Python):
while 1:
    input = raw_input()
    num = len(input)
    input = int(input)
    
    if input == 0:
        break
        
    count = 0
    for i in range(num, 0, -1):
        value = int(input / 10**(i-1))
        input -= value * 10 ** (i-1)
        count += value

    print(count)

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

Solution (Python):
while True:
    number = input()
    if number == "0":
        break
    else:
        number2 = []
        for i in range(len(number)):
            number2.append(number[i])

        number2 = map(int, number2)
        answer = sum(number2)

        print(answer)

Solution (Python):
while True:
    n = raw_input()
    if n == '0':
        break
    num = map(int,list(n))
    j= 0
    for i in num:
	j += i
    print j

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

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

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

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

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

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:
    value = [int(x) for x in raw_input()]
    if value[0] == 0:
        break
    print(sum(value))

Solution (Python):
while True:
    s = input()
    if len(s) == 1 and s[0] == '0': break
    total = 0
    for i in range(0,len(s)):
        total += int(s[i])
    print("%d" % total)

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

Solution (Python):

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

??°?????????

?????????????????°???????????????????¨??????????????????°?????????????????????????????????
"""

if __name__ == '__main__':
    while True:
        
        raw_input = input()

        if raw_input == '0':
            break

        
        total = sum(map(int, raw_input))
        print(total)

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

  print(sum([int(_) for _ in x]))

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

for val in values:
    sum = 0
    while val >= 1:
        sum += (val % 10)
        val //= 10
    print(sum)

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

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

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

Solution (Python):
N=[]
while True:
    n=raw_input()
    if n=='0':
        break
    N.append(n)
for i in range(len(N)):
    print('%d'%sum(map(int,N[i])))

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

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

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

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

Solution (Python):
n = input()
while n != "0":
    ans = 0
    for i in range(len(n)):
        ans += ord(n[i:i+1]) - 48

    print(ans)
    n = input()

Solution (Python):

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

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

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

Solution (Python):
array = []
while True:
    n = int(input())
    if n != 0:
        array.append(n)
    else:
        break
for i in range(len(array)):
    data = str(array[i])
    s = 0
    for c in data:
        s += int(c)
    print(s)

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

Solution (Python):
'''
ITP-1_8-B
 ??°?????????
?????????????????°???????????????????¨??????????????????°?????????????????????????????????
???Input
?????°??????????????????????????\?????¨??????????????????????????????????????????????????????????????´??° x ?????????????????§?????????????????????
x ??? 1000 ?????\????????´??°??§??????
x ??? 0 ?????¨?????\?????????????????¨??????????????????????????????????????????????????????????????£????????????????????????
???Output
????????????????????????????????????x ???????????????????????????????????????????????????
'''
while True:
    
    inputData = input()
    if inputData == '0':
        break

    
    outputData = 0
    for cnt0 in inputData:
        outputData += int(cnt0)
    print(outputData)

Solution (Python):
import sys

for i in sys.stdin:
    i = int(i)
    if i == 0:
        break
    (a,b) = divmod(i, 10)
    sum = b
    while a != 0:
        (a,b) = divmod(a,10)
        sum += b
    print(sum)

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

Solution (Python):
import sys

def sum_of_digits(x):
	sum = 0
	while x > 0:
		sum += x % 10
		x = x // 10

	return sum


fin = sys.stdin

while True:
	x = int(fin.readline())

	if x == 0:
		break

	print(sum_of_digits(x))

Solution (Python):



def main():
    while True:
        numbers = input()
        if int(numbers) == 0:
            break
        res = 0
        for i in numbers:
            res += int(i)
        print(res)


if __name__ == '__main__':
    main()

Solution (Python):

while True:
	x = int(input())
	if x == 0:
		break
		
	S = 0
	while True:
		if x < 10:
			S += x
			break
		else:
			r = x % 10
			S += r
			x //= 10
			
	print(S)

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

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

Solution (Python):
while 1:
    b=0
    a = [int(i) for i in input()]
    if a[0] == 0:
        break
    for i in range(len(a)):
        b += a[i]
    print(b)

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

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

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

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

    print(sum([int(x) for x in s]))

Solution (Python):
res = []
while True:
    s = input()
    if s == '0':
        break

    res.append(sum([int(x) for x in s]))

for e in res:
    print(e)

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

Solution (Python):
while(1):
	char_list = list(input())
	int_list = [0 for i in range(len(char_list))]

	if char_list[0] == '0':
		break
	for i in range(len(char_list)):
		int_list[i] = int(char_list[i])
	print(sum(int_list))

Solution (Python):
data = []
while True:
    x = input().strip()
    if x == '0':
        break
    data.append(list(map(int, list(x))))

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

Solution (Python):
array = []
suum = 0
while True:
    n = int(input())
    if n == 0:
        break
    array.append(n)
for i in range(len(array)):
    for i2 in range(len(str(array[i]))):
        suum += int(str(array[i])[i2])
    print(suum)
    suum = 0

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

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

Solution (Python):
a = raw_input()
while a!='0':
	s = 0
	for i in range(len(a)):
		s += int(a[i])

	print s
	a = raw_input()

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

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