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:
    line = input()
    if line == "0":
        break
    sum = 0
    for i in range(len(line)):
        sum += int(line[i])
    print(sum)

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

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

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

Solution (Python):
import sys

def main():
    while True:
        x = input()
        if x == '0': break
        
        SUM = 0
        for s in x:
            SUM += int(s)
        print(SUM)
    

if __name__=='__main__':
    main()

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

Solution (Python):
x=[]

while True:
    n = list(map(int,input()))
    if n[0] == 0:
        break
    x.append(n)

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

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

Solution (Python):
while True:
    num = list(map(int,input()))

    a = 0

    for i in num:
        a += i
    if a == 0:
        break
    else:
        print(a)

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    while True:
        a = list(map(int, input().rstrip()))
        if a[0] == 0:
            sys.exit()
        print(sum(a))
    
if __name__ == "__main__":
    main()

Solution (Python):

from sys import stdin

a = stdin.readline().rstrip()
while a != '0':
  
  b = [(int(i)) for i in list(a)]
  
  print(sum(b))
  a = stdin.readline().rstrip()

Solution (Python):
def caliculate(num_str):
    s=0
    for digit_str in num_str:
        s+=int(digit_str)

    return s

def run():
    num_str_list=[]
    
    while True:
        num_str=input()
        
        if num_str == "0":
            break
        
        num_str_list.append(num_str)
    
    for num_str in num_str_list:
        result=caliculate(num_str)
        print(result)

run()

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

Solution (Python):
inp=[]
while True:
	i =input() 
	if i == "0":
		break
	inp.append(i)

for s in inp:
	_sum_=0
	for ss in s:
		n=int(ss)
		_sum_+=n

	print(_sum_)

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

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

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

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

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

Solution (Python):
while True :
    x = input()
    if x == "0" :
        break
    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):
while True:
    num=str(input())
    if num=='0':
        break
    ans=0
    for i in range(len(num)):
        ans+=int(num[i])

    print(ans)

Solution (Python):
for i in range(10**3):
    s = input()
    if s == "0":
        break
    else:
        k = list(s)
        ans = 0
        for i in range(len(k)):
            ans += int(k[i])
        print(ans)

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

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

Solution (Python):
while True:
    num = int(input())
    sum = 0

    if num == 0:
        break

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

    print(sum)

Solution (Python):
for N in iter(input,"0"):
    r=0
    for n in N:
        r += int(n)
    print(r)

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

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

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:
    s = str(input())
    if int(s) == 0 : break
    n = sum([int(i) for i in s])
    print(n)

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

Solution (Python):


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

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

Solution (Python):



try:
   while True:
      x = input()
      if x == "0":
         break
      
      a = [0]*1000
      for i in range(len(x)):
         a[i] = int(x[i])
      print(sum(a))

except EOFError:
   pass

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
    print(digitSum(n))

Solution (Python):

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

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

Solution (Python):
while True:
    table = str(input())
    k =len(table)
    sum = 0
    table_num = [int(s) for s in table]


    if table_num[0] == 0:
        break

    for i in range(k):
        sum += table_num[i]
    print(sum)

Solution (Python):
x = []

for _ in range(10000):
    num = int(input())
    if num == 0:
        break
    else:
        x.append(list(str(num)))

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

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

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

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

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

Solution (Python):
def degit(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num //= 10
    return sum

num_list = []
while True:
    a = int(input())
    if a != 0:
        num_list.append(a)
    else:
        break

for i in num_list:
    print(degit(i))

Solution (Python):

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

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


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

    print(num)

Solution (Python):
input_list = []
for i in iter(input, '0'):
    input_list.append(i)

for i in input_list:
    s = 0
    for j in i:
        s += int(j)
    print(s)

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

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

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:
    numbers = list(map(int,list(input())))
    if numbers[0] == 0 and len(numbers) == 1:
        break
    print(sum(numbers))

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
    else:
        s = 0
        for let in x:
            s += int(let)
        print(s)

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

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

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

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

Solution (Python):

x = str(input())

while x != '0':
    array =list(map(int,x))
    total = sum(array)
    print(total)
    x = str(input())

Solution (Python):
input_item = []

while True:
    a = input()
    if a == '0':
        break
    input_item.append(a)

for a in input_item:
    temp = 0
    for b in a:
        temp += int(b)
    print(temp)

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

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

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

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

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

Solution (Python):
while True:
    tmp = input()
    res = 0
    if tmp != '0':
        for t in range(len(tmp)):
            
            res += int(tmp[t])
        print(res)
    else:
        break

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

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(list(map(int, s))))

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

Solution (Python):
ans_list = []

while True:
    num = input()
    if num == "0":
        break
    n = len(num)
    sum_of_digits = 0
    for i in range(n):
        sum_of_digits += int(num[i])
    ans_list.append(sum_of_digits)

for ans in ans_list:
    print(ans)

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

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

Solution (Python):
def sumsum(i):
    r = 0
    for s in str(i):
        r = r + int(s)
    return r


while True:
    i = int(input())
    if i == 0:
        break
    print(sumsum(i))

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

Solution (Python):
while 1:
    string = str(input())
    if string == '0': break

    ans = 0
    for n in list(string):
        ans += int(n)
    print(ans)

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

if __name__ == '__main__':
  main()

Solution (Python):
num = []
while True:
    a = input()
    if a == '0':
        break
    num.append(a)
ans = []
tmp = 0
for i in range(len(num)):
    tmp = 0
    for j in range(len(num[i])):
        tmp += int(num[i][j])
    
    ans.append(tmp)

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

Solution (Python):
i = 0
MAX = 1000
n = [0 for j in range(MAX)]
while True:
    d = int(input())
    if d == 0:
        break
    while d:
        n[i] += d%10
        d //= 10
    i += 1
    
for j in range(i-1):
    print(n[j])
print(n[i-1])

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

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

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

Solution (Python):
ans_str_sums = []
while True:
    S = input()
    if S == '0':
        break
    else:
        str_sum = 0
        for i in range(len(S)):
            str_sum = str_sum + int(S[i])
        ans_str_sums.append(str_sum)
for ans_str_sum in ans_str_sums:
    print(ans_str_sum)

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

result = []
for i in input_str:
    result_value = 0
    for j in i:
        result_value += int(j)
    result.append(result_value)

for i in result:
    print(i)

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

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 = str(input())
    if x == '0':
        break

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

Solution (Python):
result = []

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

    else:
        b_map = map(int, b)
        a = sum(b_map)
        result.append(a)

for i in result:
    print(i)

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

while num != "0":
    num_list.append(num)
    num = input()

for num in num_list:
    sum = 0
    l = len(num)
    while l != 0:
        sum += int(num[l-1])
        l -= 1
    print(sum)

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

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

Solution (Python):

while 1:
    ans = 0

    num_list = list(input())
    if num_list == ['0']:
        break

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

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

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

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

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

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

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

Solution (Python):
number = input()

while number != "0" :
    sum_number = 0
    for i in range(len(number)):
        sum_number += int(number[i])
    print(sum_number)
    number = input()

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

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

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

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

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

Solution (Python):

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

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

Solution (Python):
import sys
for e in sys.stdin:
    out_num = 0
    num = int(e)
    if num == 0:
        break
    for i in range(1000):
        temp = num%10
        out_num += temp
        num = num//10
        if num == 0:
            break
    print(str(out_num))

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

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

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

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

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

Solution (Python):

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

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

    if x == 0:
        break
    else:
        ans = 0

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

        print(ans)

Solution (Python):
if __name__ == "__main__":
    number_strings = []

    while True:
        number_string = input()

        if number_string == '0':
            break

        number_strings.append(number_string)

    sums = list(map(sum, map(lambda number_string: map(int, number_string), number_strings)))

    for sum in sums:
        print(sum)

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

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

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

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

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

    if X == 0:
        break

    total = 0

    while X > 0:
        total = total + (X % 10)
        X = X // 10
    
    print(total)

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

Solution (Python):
while True:
    x = input()
    ans = ''
    if x == '0':
        break
    for i in x:
        ans = ans + i + '+'
    ans = ans[:-1]
    print(eval(ans))

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

    total = 0
    for digit in n:
        total += int(digit)

    print(total)

Solution (Python):

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

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

Solution (Python):
outs = []
while True:
    out = sum([int(d) for d in input()])
    if out == 0:
        break
    outs.append(out)

print(*outs, sep="\n")

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

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

Solution (Python):
count = []

while True:
    x = input()
    if x == "0":
        break
    x_list = [int(i) for i in x]
    count.append(sum(x_list))
    
for i in range(len(count)):
    print(count[i])

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

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

Solution (Python):

import sys

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

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

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

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

Solution (Python):
def solve(n):
    print(sum(list(map(int,str(n)))))

while 1:
    n = int(input())
    if n == 0:
        break
    else:
        solve(n)

Solution (Python):
for i in iter(input, "0"):
    print(sum([int(d) for d in i]))

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

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

Solution (Python):
a = []
for i in iter(input, '0'):
    a.append(i)
for i in range(len(a)):
    print(sum(list(map(int, list(a[i])))))

Solution (Python):
while 1:
    n=int(input())
    if n==0:
        break
    s=0
    l=0
    sum=0
    while 1:
        if n>=10**s and n<10**(s+1):
            sum+=n//(10**s)
            break
        else:
            sum+=(n%(10**(s+1))-l)//(10**(s))
            l=n%(10**s)
            s+=1
    print(sum)

Solution (Python):
while True:
  s = int(input())
  if s == 0:
    break;
  else:
    lst = [int(s) for c in str(s)]
    lst = []
    while s > 0:
      lst.append(s%10)
      s //= 10
    print(sum(lst))

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

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

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:
        exit()
        
    ans = 0    
    while x:
        ans += x%10
        x //= 10
    print(ans)

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

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

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)







def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




while True:
    d = str(input())
    if d == "0":
        exit(0)

    d_list = list(d)
    ans = 0
    for num in d_list:
        ans += int(num)
    print(ans)

Solution (Python):

while True:
    s = input()
    if s=='0':break
    c = 0
    for t in s:
        c+=int(t)
    print (c)

Solution (Python):
while True:
    inp=[int(ch) for ch in input()]
    if len(inp)==1 and inp[0]==0:exit()
    print(sum(inp))

Solution (Python):
dataset = []

while True:
    n = input()
    if n == '0':
        break
    dataset.append(n)

for data in dataset:
    sum_of_digit = 0
    for n in data:
        sum_of_digit = sum_of_digit + int(n)
    print(sum_of_digit)

Solution (Python):
N = int(input())
L = []
while N != 0:
    L.append(N)
    N = int(input())
for i in range(len(L)):
    S = 0
    a = L[i]
    while a != 0:
        S += a % 10
        a = a//10
    print(S)

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

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

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

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

Solution (Python):

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

    if x == 0:
        break

    print(x)

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

Solution (Python):
nums = []
ans = []
while True:
  num = input()
  if num == "0":
    break
  nums.append(num)
for i in nums:
  total = 0
  for j in list(i):
    total += int(j)
  ans.append(total)
for k in ans:
  print(k)

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

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

Solution (Python):

while True:
    S = input()
    if S == "0":
        exit()
    print(sum([int(s) for s in S]))

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

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

Solution (Python):
while True:
  work = []
  sum = 0

  x = input()

  work = list(x)
  work = [int(i) for i in work]
  x = int(x)

  if x == 0:
    break
  
  for i in work:
    sum += i
  
  print(sum)

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

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

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

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

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

Solution (Python):
x = int(input())

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

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

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

Solution (Python):
import sys

def sa(Type= int):
  return [Type(x) for x in input().split()]

def solve(s):
  print(sum([int(x) for x in s]))

if __name__ == '__main__':
  

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

    solve(s)

Solution (Python):
while True:
    s = input()
    if s == "0":
        exit()
    sum = 0
    for st in s:
        sum += int(st)
    print(sum)

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