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 calc_sum(num):
    total=0
    while num>0:
        q = num//10
        r = num%10
        num= q
        total +=r
    return total
while True:
    
    n= int(input())
    if n==0:
         break
    print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total= 0
    while num>0:
        q = num//10
        r = num%10
        num= q
        total +=r
    return total
while True:
                  
    n = int(input())
    if n==0:
        break
    print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total=0
    while num>0:
        q = num//10
        r = num%10
        num= q
        total +=r
    return total
while True:
   
    n= int(input())
    if n==0:
         break
    print(calc_sum(n))

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

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

Solution (Python):
x_list=[]
while True:
  x = str(input())
  if x == '0':
    break
  x_list.append(x)

for i in x_list:
  a=0
  for j in range(1,len(i)+1):
    a += int(i[-j])  
  print(a)

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

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

	ls=list(num)
	ms=list(map(int,ls))
	print(sum(ms))

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

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

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total
while True:
     n = int(input())
     if n == 0:
         break
     print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r

    return total



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

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total

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

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total
while True:
    n = int(input())
    if n == 0 :
        break
    print(calc_sum(n))

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

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

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        total +=num % 10
        num //= 10
    return total   
        
while True:
    n = int(input())
    if n == 0:
     break
    print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        total += num % 10
        num //= 10
    return total
    
while True:
    n = int(input())
    if n == 0:
        break
    print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0 :
        total += num % 10
        num //= 10
    return total
    
while True:
    n = int(input())
    if n == 0:
        break
    print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total = 0
    while num > 0:
        total +=num % 10
        num //= 10
    return total
         
while True:        
    n = int(input())   
    if n == 0:
        break
    else:
        print(calc_sum(n))

Solution (Python):
def calc_sum(num):
    total=0
    while num>0:
        total+=num%10
        num//=10
    return total
 
while True:
    n=int(input())
    if n==0:
       break
    print(calc_sum(n))

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

Solution (Python):
def calc_sum(n):
    total = 0
    while n>0:
        
        total += n % 10
        n //= 10
        
    return total
        
while  True:
    n = int (input())
    result = 0
    
    if n == 0:
       break
    else:
        print (calc_sum(n))

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

Solution (Python):
def calc_sum(n):
    total = 0
    while n> 0:
        
        total += n%10
        n//=10
    return total
    
while True:
    n = int(input())
    if n== 0:
        break
    print(calc_sum(n))

Solution (Python):
def calc_sum(n):
    total = 0
    while n>0:
       
        total += n % 10
        n //= 10
    return total


n = int(input())
while n != 0:
    print(calc_sum(n))
    n = int(input())

Solution (Python):
def plus_num(n):
    total = 0
    while n>0:
        total += n % 10
        n //= 10
    return total 

    
while True:
    a = int(input())
    if a == 0:
        break
    else:
        print(plus_num(a))

Solution (Python):

B=list()
k=int(0)
while True:
  A=list(map(int,input()))
  if A[0] == 0: break
  B.append(sum(A))
  k=k+1
for i in range(k):
  print(B[i])

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

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

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

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

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

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

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

Solution (Python):
while True:
    L=input()
    l=len(L)
    if l==1 and L[0]=="0":
        break

    n=[0 for i in range(l)]

    for i in range(l):
        n[i]=int(L[i])

        sum=0

    for i in range(l):
        sum=sum+n[i]

    print(f"{sum}")

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

    if n == 0:
        break
    while n > 0:
        result += n % 10
        n //= 10
    print(result)

Solution (Python):
def abc(n):
    a = 0
    while n > 0:
        a+= n%10
        n //=10
    print(a)
    
while True:
    b = int(input())
    if b==0:
        break
    abc(b)

Solution (Python):
while True :
  n = str(input())
  if n == str(0) :
    break
    
  k = list(n)
  kk = [int(s) for s in k]
  print(sum(kk))

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

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

Solution (Python):


from collections import* 
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul
from bisect import* 
from heapq import* 
from math import factorial,pi
from copy import deepcopy
import sys

sys.setrecursionlimit(10**6)


def main():
    while 1:
        s=input()
        if s=="0":
            break
        else:
            print(sum(map(int,s)))
if __name__ == '__main__':
    main()

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

    if x == "0":
        break

    sum_num = 0

    for num_str in x:
        sum_num += int(num_str)

    print(sum_num)

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

Solution (Python):
while True:
    x = int(input())
    if x == 0:
        break
    sum1 = 0
    while x:
        x, r = divmod(x, 10)
        sum1 += r
    print(sum1)

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

Solution (Python):
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
while True:
    table = str(input())
    if(table[0] == '0'):
        break
    print(sum(int(num) for num in(table)))

Solution (Python):
while True:
    solution = 0
    x = input()
    if int(x) == 0:
        break
    elif 0 < int(x) and int(x) < 10:
        print(x)
    else:
        list_x = list(x)
        list_x = [int(s) for s in list_x]
        for i in list_x:
            solution += int(i)
        print(solution)

Solution (Python):
def digits_sum(n):
    ans = 0
    while n > 0:
        ans += n % 10
        n //= 10
    return ans


i = int(input())
while i != 0:
    print(digits_sum(i))
    i = int(input())

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

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

Solution (Python):
def sum_of_numbers(n):
    '''
    (* int -> int *)
    '''
    res = [int(n) for n in list(str(n))]
    
    return sum(res)

if __name__ == "__main__":
    while True:
        n = input()
        if n == '0':
            break
        print(sum_of_numbers(n))

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

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

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

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:
    x = input()
    ans = 0
    if x == '0':
        break
    else:
        for i in x:
            ans += int(i)
        print(ans)

Solution (Python):
switch = 0
index = []

while(switch == 0):
    string = input()
    if string == '0':
        break
    else:
        numbers = list(map(int, list(string)))
        index.append(sum(numbers))
        
for i in range(len(index)):
    print(index[i])

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

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

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

Solution (Python):
s = input()
i = int(s)
while i:
    t = 0
    for c in s:
        if c != '\n':
            t += int(c)
    print(t)
    s = input()
    i = int(s)

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

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

Solution (Python):
for x in iter(input,'0'):
    print(sum(map(int,x)))

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

Solution (Python):
while True:
  char = input()
  if int(char) == 0:break
  A = list(char)
  A_int = [int(s) for s in A]
  print(sum(A_int))

Solution (Python):




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

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

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

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

Solution (Python):
s = []

while True:
     n = int(input())
     num = []

     if n == 0:
          break
     else:
          while True:
               if n == 0:
                    break
               else:
                    num.append(n % 10)
                    n = n // 10

          s.append(sum(num))

c = len(s)

for i in range(c):
     print(s[i])

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

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

Solution (Python):
def func(N):
    lst = []
    n = N
    while n > 9:
        lst.append(n%10)
        n = n // 10
    lst.append(n)
    return sum(lst)
    
while True:
    i = int(input())
    if i == 0:
        break
    print(func(i))

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

Solution (Python):
import math

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

  for i in data:
    total += int(i)
  
  print(total)

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

    if int(a) == 0:
        break
    
    sum = 0
    for c in a:
        sum += int(c)
    
    print(sum)

Solution (Python):
for i in iter(input, '0'): 
    print(sum(map(int, i)))

Solution (Python):
odatas1 = []
odatas2 = []

while True:
    datas = list(map(int, input()))
    if len(datas) == 1 and 0 in datas:
        break
    else:
        odatas1.append(datas)


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

Solution (Python):
x = []
while True:
    x1 = int(input())
    if (x1 == 0) :
        break
    x.append(int(x1))
    
for i in range (len(x)):
    x1=str(x[i])
    s=sum(list(map(int,list(x1))))
    print(s)

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

while True:
    num = int(input())
    if num == 0:
        break
    ans = 0
    while (num > 0):
        ans += num % 10
        num = num // 10
    print(ans)

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
def calc(x: int) -> int:
    result = 0
    while x != 0:
        result += x % 10
        x //= 10
    return result


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

    print(calc(x))

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

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

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

Solution (Python):
sumData = []
while True:
    inStr = input()
    if inStr == "0":
        break
    else:
        inData = map(int,inStr)
        sumData.append(sum(inData))
for index in range(len(sumData)):
    print(sumData[index])

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

Solution (Python):
import sys

for line in sys.stdin:
    digits = line.strip()
    if digits == '0':
        break
    print(sum(map(int, digits)))

Solution (Python):



import sys

while True:
    s = sys.stdin.readline().strip()
    if s == '0':
        break
    print(sum(map(int, s)))

Solution (Python):
while 1:
    total=0
    num=list(str(input()))
    if int(num[0])==0:break
    for i in num:
        total+=int(i)
    print(total)

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

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

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

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

    if line == '0':
        break
    else:
        print(sum(map(int, line)))

Solution (Python):
num_set=[]
num=input()

while int(num)!=0:
    num_set.append(num)
    num=input()
for i in range(len(num_set)):
    num_sum=0
    j=0
    for j in num_set[i]:
        num_sum=num_sum+int(j)
    print(num_sum)

Solution (Python):
for x in iter(input,'0'):print(sum(map(int,x)))

Solution (Python):

while True:
    n  =  str(input())
    if ( n == "0"):
        break
    sum = 0
    for i in n:
      sum += int(i)
    print (sum)

Solution (Python):
import sys
for i in range(sys.maxsize):
    l=input()
    if l == "0":
        break
    else:
        s=0
        for j in range(len(l)):
            
            s+=int(l[j])
        print(s)

Solution (Python):
answer = [0 for i in range(1000)]
counter = 0
while True:
    x = input()
    if x == "0":
        break
    xx = list(x)
    for i in xx:
        answer[counter] += int(i)
    counter += 1

for i in range(counter):
    print(answer[i])

Solution (Python):
xlist = []

while(1):
    x = int(input())

    if x == 0:
        break

    xlist.append(x)

for x in xlist:
    ans = 0
    while(1):
        n = x % 10
        ans += n
        x //= 10
        if x == 0:
            print(ans)
            break

Solution (Python):
while True:
    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:
	x = input()
	if x == '0': break
	sum=0
	for i in x:
		sum += int(i)
	print(sum)

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

Solution (Python):
def disa_digit(num):
    result = []

    while num > 0:
        result.append(num%10)
        num //= 10
    return result

while True:
    n = int(input())
    if n == 0:
        break
    else:
        print(sum(disa_digit(n)))

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

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

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

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

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

Solution (Python):
while True:
	num=str(input())
	a=[]
	ans=0
	if num=='0':
		break
	else:
		for i in num:
			a.append(i)
		b=list(map(int,a))
		for j in range(len(b)):
			ans+=b[j]
		print(ans)

Solution (Python):




i = 0
while True:
    N=input()
    if N=="0":
        break
    result=sum([int(char) for char in N])
    print(result)

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

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

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

Solution (Python):
x = int(input())
result = []
while (x):
    sum = 0
    sum += x % 10 
    x //= 10
    while (x):
        sum += x % 10
        x //= 10
    result.append(sum)
    x = int(input())

for i in result:
    print(i)

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

Solution (Python):
while True:
    num = str(input())
    if num == '0':
        break
        
    digitSum = 0

    for i in range(len(num)):
        digitSum += int(num[i])

    print(digitSum)

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

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

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

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

Solution (Python):
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


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

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

    keta = []
    sum = 0

    for i in number:
        keta.append(i)

    keta2 = list(map(int, keta))

    for i in keta2:
        sum += i

    print(sum)

Solution (Python):
L = []
while True:
    A = int(input())
    if A == 0:
        break

    L.append(A)
for i in range(len(L)):
    sum = 0
    for k in range(len(str(L[i]))):
        sum = sum +int(str(L[i])[k])

    print(sum)

Solution (Python):
for a in iter(raw_input,'0'):print sum(map(int,str(a)))

Solution (Python):
cnt=0
for i in range(10000):
    S=str(input())
    if S=="0":
        break
    else:
        for j in range(len(S)):
            cnt+=int(S[j])
        print(cnt)
        cnt=0

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

Solution (Python):

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

Solution (Python):


if __name__ == '__main__':
    while True:
        s = raw_input()
        if s == '0':
            break
        print sum(map(int, list(s)))

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

Solution (Python):
sss = input()
while not sss == '0':
	counter = 0
	num = int(sss)
	while num > 0:
		counter += num % 10
		num //= 10
	print(counter)
	sss = input()

Solution (Python):
tmp = []
output = []
for x in range(0,10000):
    tmp = input()
    if tmp == '0':
        break
    else :
        output.append( sum(int(tmp[i]) for i in range(len(tmp))) )
for x in range(len(output)):
    print(output[x])