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:
    nun_list =list(str(input()))
    n = len(nun_list)
    c = 0
    
    if int(nun_list[0]) == 0:
        break

    for i in range(n):
        c = c + int(nun_list[i])
    print(c)

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

Solution (Python):
lst = []
while True:
    a = input()
    if a == "0":
        break
    else:
        lst.append(a)
for i in lst:
    ans = 0
    for j in i:
        ans += int(j)
    print(ans)

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

Solution (Python):
try:
    while True:
        x = str(input())
        if int(x) == 0 :
            exit()
        digit_list = list(x)
        i = 0
        sum = 0
        while i < len(digit_list):
            sum = sum + int(digit_list[i])
            i += 1
        print(sum)
except EOFError:
    pass

Solution (Python):
def countDigits(num):
    ans = 0
    while num:
        ans+=num%10
        num//=10
    return ans

while True:
    num = int(input())
    if num == 0:
        break
    else:
        print(countDigits(num))

Solution (Python):
def main(text):
    sum = 0
    for char in text:
        sum += int(char)
    return sum


if __name__ == "__main__":
    while True:
        text = str(input())
        if text == '0':
            break
        print(main(text))

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

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

    print(sum(input_num))

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

Solution (Python):
while(True):
    a = input()
    if a == '0':
        break
    else:
        d = 0
        for b in a:
            c =int(b)
            d += c
        else:
            print(d)

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

Solution (Python):
import sys
import itertools
import math



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

while 1:
    S=readline().decode().rstrip()
    if S=='0':
        break
    ans=0
    for i in S:
        ans+=int(i)
    print(ans)

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

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

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

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

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

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

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

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

for strnum in inputs:
    sum_str = 0
    for num in strnum:
        sum_str += int(num)
    print(sum_str)

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

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

Solution (Python):
*x, = map(int, input())
while sum(x) != 0:
    print(sum(x))
    *x, = map(int, input())

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

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

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

Solution (Python):
while True:
    n = int(input())
    if n==0: break
    
    cnt=0
    for s in str(n):
        cnt+=int(s)
    print(cnt)

Solution (Python):
while 1:
    x=input()
    if x=="0":
        break;
    else:

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

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

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

Solution (Python):
def digit_sum(n):
    s = str(n)
    ret = 0
    for i in range(len(s)):
        ret += int(s[i])
    return ret

x = int(input())
while x != 0:
    print(digit_sum(x))
    x = int(input())

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

Solution (Python):
answer = []

while True:
    inp = list(map(int, input()))
    if (len(inp) == 1) and (inp[0] == 0):
        break
    answer.append(str(sum(inp)))

[print(answer[i]) for i in range(len(answer))]

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

Solution (Python):
for _ in range(10000):
    i = input()

    if i == '0':
        break

    ans = 0

    for n in i:
        ans += int(n)

    print(str(ans))

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

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):
while True:
    x = int(input())
    if x == 0:
        break
    ans = 0
    while x >= 10:
        ans += x % 10
        x //= 10
    print(ans+x)

Solution (Python):

result = list()


while True:
    input_data = list(input())
    input_data_int = [int(d) for d in input_data]
    if input_data_int[0] == 0:
        break
    result.append(sum(input_data_int))


[print(i) for i in result]

Solution (Python):
zero = 48
while True:
 xs = input()
 if xs=="0":
  break
 S = 0
 x = list(map(int,xs.encode()))
 for i in x:
  S = S+i-zero
 print(S)

Solution (Python):
queue=[]

count=0
queue.append([int(i) for i in list(input())])

while not queue[count]==[0]:
    queue.append([int(i) for i in list(input())])
    count+=1

for i in range(count):
    wa=0
    for w in range(len(queue[i])):
        wa+=queue[i][w]
    print(wa)

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

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

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

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

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

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

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

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

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

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

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

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:
    a=input()
    if a==0:
        break
    b=0
    for i in range(len(str(a))):
        b+=a%10
        a=a/10
    print b

Solution (Python):
def sum_number(num):
    total = 0
    while num:
        total += num % 10
        num //= 10
    return total


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

Solution (Python):
def sum_of_numbers(num):

    s = 0

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

    print(str(s)+"\n", end="")

if __name__ == "__main__":
    

    while(True):

        number = input()

        if int(number) == 0:
            break 

        sum_of_numbers(number)

Solution (Python):
while True:

    n = input()
    
    if n == "0":
        break

    s = 0
    for i in n:
        s += int(i)

    print(s)

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
D = open(0).read().split()[:-1]
for d in D:
    e = [int(x) for x in d]
    print(sum(e))

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

for i in range(len(strings)):
    print(sum(map(int, strings[i])))

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

    r = 0
    for c in s:
        r += int(c)

    print(r)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    
    s=input()
    while s!="0":
        print(sum(int(c) for c in s))
        s=input()

main()

Solution (Python):
ans = 0
for i in range(10000):
    x = input()
    if x == "0":
        break
    else:
        for i in range(len(x)):
            ans += int(x[i])
        print(ans)
        ans = 0

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

Solution (Python):
result = []

while True:
    n = input()

    if n == '0':
        break

    tmp = 0
    for i in range(len(n)):
        tmp += int(n[i])

    result.append(tmp)

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

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

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

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

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

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
    count = 0
    for i in s:
        count += int(i)
    print(count)

Solution (Python):
while 1:
    input_num=str(input())
    sum=0
    if input_num=="0":
        break
    for index in range(len(input_num)):
        sum=sum+int(input_num[index])
    print("%d" % sum)

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

Solution (Python):
c=input()
while c!='0':
    c=list(c)
    ans=0
    for i in c:
        ans+=int(i)
    print(ans)
    c=input()

Solution (Python):

y = 0
Z = []
while True:
    x = input()
    if x == "0":
        break
    else:
        A = list(map(int,x))
        for i in A:
            y += i
        Z.append(y)
        y = 0

for i in Z:
    print(i)

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

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

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

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

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

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

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

Solution (Python):
while True:
    sum=0
    a=list(map(str,input()))
    if a[0]=='0':
        break
    for i in range(len(a)):
        sum+=int(a[i])
    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):
while True:
    a = input()
    sum = 0
    if int(a)!=0:
        for i in range(len(a)):
            sum = sum + int(a[i])
        print(sum)
    else:
        break

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

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

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

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 1:
    s=input()
    if s=="0":
        break
    ans=0
    for i in s:
        ans+=int(i)
    print(ans)

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

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

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

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

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

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

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

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

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

Solution (Python):
import sys

while True:
    n = list(map(int, input()))
    if n == [0]:
        sys.exit()
    else:
        print(sum(n))

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

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

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

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

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

    print(sum)

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

Solution (Python):
li = []

while True:
    buf = input()
    if buf == '0':
        break
    li.append(buf)

sums = []
for v in li:
    sum = 0
    for a in v:
        sum += int(a)
    sums.append(sum)

for v in sums:
    print(v)

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

    print(sum(a))

Solution (Python):
from functools import reduce
while True:
    x = input()
    if x == "0":
        break
    print(reduce(lambda a, b : a + b, map(int, list(x))))

Solution (Python):
while(1):
    din=int(input())
    if din==0:
        break
    ans=0
    flg=1
    while(flg):
        ans = ans + din%10
        din = din//10
        if din ==0:
            flg=0
    print(ans)

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

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

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

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

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

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

Solution (Python):
def test():

	while True:

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

		sum = 0
		for i in range(len(string)):
			sum += int(string[i])
		print(f"{sum}")

if __name__ == "__main__":
	test()

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

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

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

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

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

    print(sum)

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

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

i = 0
while x[i]!=0:
    out = dig_sum(x[i])
    print(out)
    i += 1

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

Solution (Python):
while 1:
    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(list(map(int,list(x)))))

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

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

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

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):
import sys,os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations
sys.setrecursionlimit(10**6)

while 1:
    s=int(input())
    if s==0:
        break
    s=str(s)
    cnt=0
    for i in s:
        cnt+=int(i)
    print(cnt)

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

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

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

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

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):
n = list(input())
n = list(map(int, n))
while(not n==[0]):
  print(sum(n))
  n=list(input())
  n = list(map(int, n))

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:
	ans=0
	s=input()
	if s=='0':
		break
	for x in s:
		ans += ord(x) - 48
	print(ans)

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

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

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

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

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

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

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

    if x == '0':
        break

    n = 0
    for i in x:
        n += int(i)

    print(n)

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

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

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

Solution (Python):


while True:
   line = input()

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

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

Solution (Python):
if __name__ == "__main__":
    while(True):
        input_str = input()
        if (input_str == "0"):
            break
        print("{}".format(sum([int(s) for s in input_str])))

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

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

Solution (Python):
while 1:
    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 str(x)))

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

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

Solution (Python):






import sys
import math
import array


class mymath:
    
    pi = 3.14159265358979323846264338

    
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()


class output:
    
    def list(self, l):
        l = list(l)
        
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()



















def main():
    A = []
    while True:
        N = input()
        if N == '0':
            break
        A.append(N)
    
    for i in A:
        ans = 0
        for j in i:
            ans += int(j)
        print(ans)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
x=1
while x!=0:
  x=int(input())
  if x!=0:
    listA=list(str(x))
    listB=[int(i) for i in listA]
    SUM=sum(listB)
    print(SUM)

Solution (Python):
import math
def sum_digit(num):
	ans = 0
	current = num
	while current > 0:
		a = current%10
		ans += a
		current = current//10
	print(int(ans))
	
while True:
	num = int(input())
	if int(num) == 0:
		break	
	else:
		sum_digit(num)

Solution (Python):
c = 0
while c == 0:
    ans = 0
    x = int(input())
    if x == 0:
        
        c = 1
    else:
        for i in range(1,len(str(x))+1):
            if x >= 10:
                ans += x  % 10
                x = x // 10
            else:
                ans += x
            
        print(ans)

Solution (Python):

ansl = []

while True:

    x = input()

    if x == "0":
        break

    now = 0
    for i in x:

        now += int(i)


    ansl.append(now)


for i in ansl:

    print (i)

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

    print(sum)

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
        total += r
        num = q
        
    
    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):
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))