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:
def sum_all_digit(num):
    r = 0
    while True:
        num, remainder = divmod(num, 10)
        r += remainder
        if num == 0: return r



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


Input()

Submission status: Accepted

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

    total = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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 True :
    s = input()

    if (s == "0"):
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_list = []

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=[]
while True:
    num.append(input())
    if num[-1]=="0":
        num=num[:-1]
        break
ans=[sum(map(int,list(i)))for i in num]
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
results = []

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = int(input())
    if x == 0: break
    else:
        def digitSum(x): # 数値を文字列に変換
            s = str(x)       # １文字ずつ数値化し配列にする。
            array = list(map(int, s))    # 合計値を返す
            return sum(array)
        print(digitSum(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L=[]

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

                
            else:
                L.append(0)

        print(sum(L))
        L=[]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    if buf == 0:
        break

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

    print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


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


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

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

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

  if x == 0:
    break

  print(x)

Submission status: Accepted

Solution code:
#55 数字の和

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = input()
    y = 0
    z = int(x)
    if z <= 0:
        break
    else:
        for i in range(len(x)):
            y += int(x[i])
        print(y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
while x!=0:
    
    list=[]
    while x>0:
        list.append(x%10)
        x=x//10
    print(sum(list))
    
    x=int(input())

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = []

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

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

for n in result:
    print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

flag = True
a = []

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    if x == 0:
        break

    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
    n = input()
    if n == "0":
        break
    print(sum(int(x) for x in n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
    num = list(map(int,input()))

    a = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
# a = input()
a = stdin.readline().rstrip()
while a != '0':
  # [sum += int(i) for i in list(a)]
  b = [(int(i)) for i in list(a)]
  #print(b)
  print(sum(b))
  a = stdin.readline().rstrip()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    if num == 0:
        break

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

    print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
#55
while True:
    x = input()
    if x=='0':
        break
    a = list(map(int,x))
    print(sum(a))

Submission status: Accepted

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