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):
while True:
    n = input()
    if n == "0":
        break
    else:
        s=0
        for i in range(len(n)):
            s += int(n[i])
        print(s)

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

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

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

Solution (Python):
while True:
    X=input()
    if X=='0':
        break
    A=list(int(i) for i in list(str(X)))
    print(sum(A))

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

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

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

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

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

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

Solution (Python):
ans = []
while True:
	a = str(input())
	if a == "0":
		break
	else:
		a = list(map(int,list(a)))
		ans.append(sum(a))
for i in ans:
	print(i)

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

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

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

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

Solution (Python):
answer_lst=[]
while True:
    initial_value=0
    x=int(input())
    if x==0:
        break
    string=str(x)
    for i in string:
        initial_value+=int(i)
    answer_lst.append(initial_value)
for ans in answer_lst:
    print(ans)

Solution (Python):
while True:
    try:
        a=list(input())
        b=0
        for i in range(len(a)):
            b+=int(a[i])
        if b!=0:
            print(b)
    except EOFError:
        break

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

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

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

Solution (Python):
while True :

    
    try :
        a=int(input())
        if a==0:
            break
        else:
            n = sum(list(map(int, str(a))))
            print(n)
        
    except EOFError:
        pass

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

Solution (Python):
sum=0
list=[]
sum_list=[]
while True:
    n=int(input())
    if n!=0:
        list.append(n)
    else:
        break
for i in list:
    i=str(i)
    for j in range(len(i)):
        sum+=int(i[j])
    sum_list.append(sum)
    sum=0

for i in sum_list:
    print(i)

Solution (Python):
while 1:
    S = input()
    if S == '0':
        break
    else:
        ans = 0
        for s in S:
            ans += int(s)
        print(ans)

Solution (Python):
ans=[]
while_count=0
while True:
    n=input()
    if int(n[0])==0:
        break
    count=0
    for i in range(len(n)):
        count+=int(n[i])
    ans.append(count)
    n=[]
    while_count+=1

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

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

Solution (Python):
l = []
while True:
  e = input()
  if e=='0':
    break
  s = 0
  for i in range(0, len(e)):
    s += int(e[i])
  l.append(s)

print('\n'.join(map(str,l)))

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

Solution (Python):

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

Solution (Python):

while 1:
    
    S = input()
    if( S == "0"):
        break        
    S_int = [int(s) for s in S]
    print( sum(S_int) )

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

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

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

Solution (Python):

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

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(i) for i in x))

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

Solution (Python):
xretu = []
xtasi = []

while True:
  retu = int(input())
  if retu == 0:
    break
  xretu.append(retu)

for a in xretu:
  xtasi.append(str(a))

for b in xtasi:
  kei = 0
  bnaga = len(b)
  for c in range(bnaga):
    kei += int(b[c])
  print(kei)

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

    for i in range(len(S)):
        ans += int(S[i])
    print(ans)

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

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

Solution (Python):




def main():
    while True:
        x = input()
        if x == "0":
            break
        r = 0
        for i in range(len(x)):
            r += int(x[i])
        print(r)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

Solution (Python):


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

Solution (Python):
def sum_all_digit(num):
    r = 0
    while True:
        num, remainder = divmod(num, 10)
        r += remainder
        if num == 0: return r



def Input():
    while True:
        num = int(input())
        if not num: break
        print(sum_all_digit(num))


Input()

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

    total = 0

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

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

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

Solution (Python):


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

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

    if (s == "0"):
        break

    else:
        sarray = list(map(int,s))
        print(sum(sarray))

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

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

Solution (Python):
while True:
  n = int(input())
  if n == 0:
    break
  values = []
  while n > 0:
    values.append(n%10)
    n //= 10
  values.reverse()
  total = sum(values)
  print(total)

Solution (Python):
num_list = []

while True:
    num_input = input()
    if num_input == '0':
        break
    num_list.append(num_input)

for num in num_list:
    c = 0
    for a_figure in num:
        c += int(a_figure)
    print(c)

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):
while True:
    x=int(input())
    if x==0:
        break
    result=sum(list(map(int,str(x))))
    print(result)

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

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:
    n=int(input())
    if n==0:
        break
    def digitSum(n):
        s = str(n)
        array = list(map(int, s))
        return sum(array)
    print(digitSum(n))

Solution (Python):
for i in range(1000):
    a=int(input())
    if a == 0:
        break
    b=sum(list(map(int,str(a))))
    print(b)

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

Solution (Python):
import sys
while True:
    x = input()
    if x == '0':
        sys.exit()
    s = 0
    for i in range(len(x)):
        s += int(x[i])
    print(s)

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

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

Solution (Python):
while True:
  n = int(input())
  if n == 0: break
  def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
  print(digitSum(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):
num=[]
while True:
    num.append(input())
    if num[-1]=="0":
        num=num[:-1]
        break
ans=[sum(map(int,list(i)))for i in num]
for i in ans:
    print(i)

Solution (Python):
results = []

while True:
    num = input()
    if int(num) == 0:
        for i in results:
            print(i)
        break
    nums = [int(i) for i in num]
    results.append(sum(nums))

Solution (Python):



while True:
    n = str(input())
    if (n[0] == "0"):
        break
    m =list(map(int,n))
    print(sum(m))

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

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):
while True:
    a = input()
    if a == '0':
        break
    else:
        print(sum(map(int,a)))

Solution (Python):
import sys

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

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

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

Solution (Python):
a=[]
while True:
    n=int(input())
    if n==0:
        break
    d=str(n)
    a=list(d)
    b=len(a)
    s=0
    for i in range(b):
        c=int(a[i])
        s += c
    print(s)

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

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

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

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

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

Solution (Python):
data = []
while True:
    a = input()
    if a == "0":
        break
    data.append(a)
for b in data:
    c = 0
    for d in b:
        d = int(d)
        c += d
    print(c)

Solution (Python):
L=[]

while True:
    A=int(input())
    
    if A==0:
        break
    
    else:
        for i in  reversed (range(1001)):
            if A>=10**i:
                B=A//10**i
                A-=B*10**i
                L.append(B)

                
            else:
                L.append(0)

        print(sum(L))
        L=[]

Solution (Python):

while True:
    number = int(input())
    if number <= 0:
        break
    num_list = []
    for n in str(number):
        num_list.append(int(n))
    print(sum(num_list))

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

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

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):

while True:
    x = int(input())
    x_str = str(x)
    add = 0
    if x == 0:
        break
    else:
        for i in range(len(x_str)):
            add += int(x_str[i])
        print(add)

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

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

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

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

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:
    S = input().strip()
    if int(S) == 0:
        break
    ans = 0
    for s in S:
        ans += int(s)
    print(ans)

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

Solution (Python):
flag = True
while flag:
    s = 0
    a = int(input())
    if a == 0:
        break;
    while a > 0:
        s += a % 10
        a = a//10
    print(s)

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

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

Solution (Python):
XS = list(open(0).read().split())
for x in XS:
    if x == "0":
        break
    print(sum(map(int, list(x))))

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

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

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

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

    if buf == 0:
        break

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

    print(sum)

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

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

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

Solution (Python):
import sys


def resolve():
    for x in sys.stdin:
        if int(x) == 0:
            break
        nums = [int(x) for x in list(x) if x != "\n"]
        print(sum(nums))


resolve()

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

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

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

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

Solution (Python):
l = []
while True:
  x = int(input())
  if x == 0:
    break
  t = 0
  for n in str(x):
    t += int(n)
  l.append(t)
for s in l:
  print(s)

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

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

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

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

Solution (Python):
def gokei(x):
    y = list(map(int,x))
    return sum(y)

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

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):
while True:
  num = int(input())
  
  if num == 0: break
  else:
   num = str(num)
   lst = list(num)
   l = len(lst)
   ans = 0
   for i in range(l):
    ans += int(lst[i])
  print(ans)

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

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

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

Solution (Python):


def main():
    while True:
        number=input()
        if int(number)==0:
            break
        ans=0
        for digit in number:
            ans+=int(digit)
        print(ans)

if __name__=="__main__":
    main()

Solution (Python):
while True:
    S = input().strip()
    if int(S) == 0:
        break
    ans = 0
    for s in S:
        ans += int(s)
    print(ans)

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

Solution (Python):
while True:
    bb=0
    a=int(input())
    if a==0:
        break
    else:
        aa=list(str(a))
        le=len(aa)
        for n in range(0, le):
            b=int(aa[n])
            bb=bb+b
        print(bb)

Solution (Python):

a = []
n = 0
i = 0
j = 0
sum = 0

while True:
    a.append(list(input()))

    if int(a[n][0]) == 0:
        break
    n += 1

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

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

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

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

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

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

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

  if x == 0:
    break

  print(x)

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 = input()
    if x == "0":
        break
    x = list(x)
    x = map(int, x)
    print(sum(x))

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

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()
    y = 0
    z = int(x)
    if z <= 0:
        break
    else:
        for i in range(len(x)):
            y += int(x[i])
        print(y)

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 :
    a= input()
    if a == '0': break
    sm=0
    for i in range (len(a)) :
        s=int(a[i])
        sm+=s
    print(sm)

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

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

Solution (Python):
try:
    while True:
        for i in range(10000):
            a = input()
            taiga = 0
            if a == 0:
                break
            b = len(a)
            for c in range(b):
                taiga += int(a[c])
            if taiga == 0:
                continue
            else:
                print(taiga)
except EOFError:
    pass

Solution (Python):



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

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

Solution (Python):
a = []
while True:
    n = int(input())
    if n == 0:
        break
    d = str(n)
    a = list(d)
    b = len(a)
    s = 0
    for i in range(b):
        c = int(a[i])
        s += c
    print(s)

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

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())

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


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

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

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

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

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

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

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

Solution (Python):
i = []

while True:
    s = input()
    if s == '0':
        break
    i.append(s)

result = []
for s in i:
    ss = 0
    for c in s:
        ss += int(c)
    result.append(ss)

for n in result:
    print(n)

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

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

Solution (Python):
def isEnd(t):
    if t == 0:
        return True
    return False

def answer(num):
    ret = 0
    while num != 0:
        ret += num % 10
        num //= 10
    return ret

flag = True
a = []

while flag:
    t = int(input())
    if isEnd(t):
        flag = False
        continue
    a.append(t)

for i in a:
    ans = answer(i)
    print(ans)

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

Solution (Python):
text = ''
def digitsum(n):
    s = str(n)
    lst = list(map(int,s))
    return sum(lst)

while True:
    try:
        text = input()
        if text == '0':
            break
        else:
            print(digitsum(text))
    except EOFError:
        break

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

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

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

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

Solution (Python):
while True:
    n = int(input())
    if n == 0:
        break
    else:
        ns = str(n)
        nl = len(ns)
        countn = 0
        for i in range(nl):
            countn += int(ns[i])
        print(countn)

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:
    n=int(input())
    if n==0:
        break
    else:
        t=sum(list(map(int, str(n))))
        print(t)

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

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

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

Solution (Python):
EOL = '0'
for x in iter(input, EOL):
    print(sum([int(c) for c in x]))

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

Solution (Python):
x=0
while True:
    try:
        a=list(input())
        if a==0:
            break
        else:
            for i in range (len(a)):
                a[i]=int(a[i])
                x+=a[i]
            if x!=0:
                print(x)
            x=0
    except:
        break;

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

Solution (Python):
string = []
while True:
    string.append(input())
    if string[-1] == '0':
        string.remove('0')
        break
for s in string:
    sum = 0
    for i in range(len(s)):
        sum += int(s[i])
    print(sum)

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

    result = sum(list(map(int, str(a))))
    
    print(result)

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

    if x == 0:
        break

    print(x)

Solution (Python):
while True:
    s = list(map(str, input().split()))
    S = list(s[0])
    if S[0] == "0":
        break
    else:
        S_sum = sum([int(i) for i in S])
        print(S_sum)

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

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

Solution (Python):
import sys
a = []
for l in sys.stdin:
    if int(l) == 0:
        break
    a.append(l)

for w in a:
    ans = 0
    for num in w:
        if str(num).isnumeric():
            ans += int(num)
    print(ans)

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

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

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