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



Sample input:
123
55
1000
0


Sample output:
6
10
1

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

    if table_num[0] == 0:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = input()
    if x == '0':
        break
    else:
        s = 0
        for let in x:
            s += int(let)
        print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ITP1_8_B:Sum of Numbers
x = str(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
number = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

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

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

        print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    if X == 0:
        break

    total = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(total)

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = int(input())
    if x == 0:
        exit()
        
    ans = 0    
    while x:
        ans += x%10
        x //= 10
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

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


# ===CODE===

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)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#2020-03-19
while True:
    x = sum(map(int, input()))

    if x == 0:
        break

    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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__':
  # sys.stdin = open('input.txt', 'r')

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

    solve(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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