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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x_list=[]
while True:
  x = str(input())
  if x == '0':
    break
  x_list.append(x)

for i in x_list:
  a=0
  for j in range(1,len(i)+1):
    a += int(i[-j])  
  print(a)

Submission status: Accepted

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

Submission status: Accepted

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

	ls=list(num)
	ms=list(map(int,ls))
	print(sum(ms))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total
while True:
     n = int(input())
     if n == 0:
         break
     print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r

    return total
# <--- function

# --> main roution
while True:
    n = int(input())
    if n == 0:
        break
    print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total

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

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        r = num % 10
        q = num // 10
        num = q
        total += r
    return total
while True:
    n = int(input())
    if n == 0 :
        break
    print(calc_sum(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        total +=num % 10
        num //= 10
    return total   
        
while True:
    n = int(input())
    if n == 0:
     break
    print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        total += num % 10
        num //= 10
    return total
    
while True:
    n = int(input())
    if n == 0:
        break
    print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0 :
        total += num % 10
        num //= 10
    return total
    
while True:
    n = int(input())
    if n == 0:
        break
    print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total = 0
    while num > 0:
        total +=num % 10
        num //= 10
    return total
         
while True:        
    n = int(input())   
    if n == 0:
        break
    else:
        print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(num):
    total=0
    while num>0:
        total+=num%10
        num//=10
    return total
 
while True:
    n=int(input())
    if n==0:
       break
    print(calc_sum(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc_sum(n):
    total = 0
    while n>0:
        #print(n//10, n % 10)
        total += n % 10
        n //= 10
        
    return total
        
while  True:
    n = int (input())
    result = 0
    
    if n == 0:
       break
    else:
        print (calc_sum(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc_sum(n):
    total = 0
    while n> 0:
        #print(n//10, n% 10)
        total += n%10
        n//=10
    return total
    
while True:
    n = int(input())
    if n== 0:
        break
    print(calc_sum(n))

Submission status: Accepted

Solution code:
def calc_sum(n):
    total = 0
    while n>0:
       # print(n // 10, n % 10)
        total += n % 10
        n //= 10
    return total


n = int(input())
while n != 0:
    print(calc_sum(n))
    n = int(input())

Submission status: Accepted

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

    
while True:
    a = int(input())
    if a == 0:
        break
    else:
        print(plus_num(a))

Submission status: Accepted

Solution code:
#ITP1_8_B
B=list()
k=int(0)
while True:
  A=list(map(int,input()))
  if A[0] == 0: break
  B.append(sum(A))
  k=k+1
for i in range(k):
  print(B[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
  x = sum(map(int,list(input())))
  if x == 0:
    break
  print(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:
while True:
    L=input()
    l=len(L)
    if l==1 and L[0]=="0":
        break

    n=[0 for i in range(l)]

    for i in range(l):
        n[i]=int(L[i])

        sum=0

    for i in range(l):
        sum=sum+n[i]

    print(f"{sum}")

Submission status: Accepted

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

    if n == 0:
        break
    while n > 0:
        result += n % 10
        n //= 10
    print(result)

Submission status: Accepted

Solution code:
def abc(n):
    a = 0
    while n > 0:
        a+= n%10
        n //=10
    print(a)
    
while True:
    b = int(input())
    if b==0:
        break
    abc(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


def main():
    while 1:
        s=input()
        if s=="0":
            break
        else:
            print(sum(map(int,s)))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
while True:
    x = input()

    if x == "0":
        break

    sum_num = 0

    for num_str in x:
        sum_num += int(num_str)

    print(sum_num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = int(input())
    if x == 0:
        break
    sum1 = 0
    while x:
        x, r = divmod(x, 10)
        sum1 += r
    print(sum1)

Submission status: Accepted

Solution code:
while True :
  a = input()
  if(a == "0") :
    break
  else :
    b = list(map(int, a))  #1文字ずつ数値化して配列にする
    print(sum(b))

Submission status: Accepted

Solution code:
while True:
    solution = 0
    x = input()
    if int(x) == 0:
        break
    elif 0 < int(x) and int(x) < 10:
        print(x)
    else:
        list_x = list(x)
        list_x = [int(s) for s in list_x]
        for i in list_x:
            solution += int(i)
        print(solution)

Submission status: Accepted

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


i = int(input())
while i != 0:
    print(digits_sum(i))
    i = int(input())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sum_of_numbers(n):
    '''
    (* int -> int *)
    '''
    res = [int(n) for n in list(str(n))]
    
    return sum(res)

if __name__ == "__main__":
    while True:
        n = input()
        if n == '0':
            break
        print(sum_of_numbers(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	s = str(input())
	while s != "0":
		ans = 0
		for i in range(len(s)):
			ans += int(s[i])
		print(ans)
		s = str(input())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
switch = 0
index = []

while(switch == 0):
    string = input()
    if string == '0':
        break
    else:
        numbers = list(map(int, list(string)))
        index.append(sum(numbers))
        
for i in range(len(index)):
    print(index[i])

Submission status: Accepted

Solution code:
while True:
	string = input()
	if string == '0':
		break
	print(sum(int(character) for character in string))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
i = int(s)
while i:
    t = 0
    for c in s:
        if c != '\n':
            t += int(c)
    print(t)
    s = input()
    i = int(s)

Submission status: Accepted

Solution code:
flag = True
while flag == True:
    str_number = input()
    if str_number == '0':
        break
    int_number = [int(n) for n in str_number]
    sum_number = sum(int_number)
    print(sum_number)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# ITP1_8_B
# 数字の和

while 1:
    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 = str(input())
    if(a[0] == '0'):
        break
    print(sum(int(num) for num in a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = []

while True:
     n = int(input())
     num = []

     if n == 0:
          break
     else:
          while True:
               if n == 0:
                    break
               else:
                    num.append(n % 10)
                    n = n // 10

          s.append(sum(num))

c = len(s)

for i in range(c):
     print(s[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func(N):
    lst = []
    n = N
    while n > 9:
        lst.append(n%10)
        n = n // 10
    lst.append(n)
    return sum(lst)
    
while True:
    i = int(input())
    if i == 0:
        break
    print(func(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

while True:
  data = input()
  total = 0
  if int(data) == 0:
    break

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

Submission status: Accepted

Solution code:
while True:
    a = input()

    if int(a) == 0:
        break
    
    sum = 0
    for c in a:
        sum += int(c)
    
    print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
odatas1 = []
odatas2 = []
# sum = 0
while True:
    datas = list(map(int, input()))
    if len(datas) == 1 and 0 in datas:
        break
    else:
        odatas1.append(datas)

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

# 今回、TypeError: 'int' object is not callableというエラーを吐いた
# 理由は3行目に sum = 0 を定義していたために発生した
# ビルトイン関数(組み込み関数)と同じ名前の変数を定義するとこのエラーがでる。
# ex) sum, max, min, str

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1 :
    l=[int(x) for x in input()]
    if l[0] == 0:
        break
    num = 0
    for i in l:
        num += i
    else:
        print(num)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
while True:
    s = str(input())
    if s == "0":break
    result=0
    for i in s:
        result+=int(i)
    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:
# coding: utf-8
while True:
    num = int(input())
    if num == 0:
        break
    ans = 0
    while (num > 0):
        ans += num % 10
        num = num // 10
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc(x: int) -> int:
    result = 0
    while x != 0:
        result += x % 10
        x //= 10
    return result


while True:
    x = int(input())
    if x == 0:
        break

    print(calc(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sumData = []
while True:
    inStr = input()
    if inStr == "0":
        break
    else:
        inData = map(int,inStr)
        sumData.append(sum(inData))
for index in range(len(sumData)):
    print(sumData[index])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    digits = line.strip()
    if digits == '0':
        break
    print(sum(map(int, digits)))

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

while True:
    s = sys.stdin.readline().strip()
    if s == '0':
        break
    print(sum(map(int, s)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    line = input()

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

Submission status: Accepted

Solution code:
num_set=[]
num=input()

while int(num)!=0:
    num_set.append(num)
    num=input()
for i in range(len(num_set)):
    num_sum=0
    j=0
    for j in num_set[i]:
        num_sum=num_sum+int(j)
    print(num_sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
import sys
for i in range(sys.maxsize):
    l=input()
    if l == "0":
        break
    else:
        s=0
        for j in range(len(l)):
            #print(l[j])
            s+=int(l[j])
        print(s)

Submission status: Accepted

Solution code:
answer = [0 for i in range(1000)]
counter = 0
while True:
    x = input()
    if x == "0":
        break
    xx = list(x)
    for i in xx:
        answer[counter] += int(i)
    counter += 1

for i in range(counter):
    print(answer[i])

Submission status: Accepted

Solution code:
xlist = []

while(1):
    x = int(input())

    if x == 0:
        break

    xlist.append(x)

for x in xlist:
    ans = 0
    while(1):
        n = x % 10
        ans += n
        x //= 10
        if x == 0:
            print(ans)
            break

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:
while True:
  x = sum(map(int, input()))

  if x == 0:
    break

  print(x)

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:
    innumber = str(input())
    ans=0
    if int(innumber)==0:
        break
    for i in range(0, len(innumber)):
        ans+=int(innumber[i])
    print(ans)

Submission status: Accepted

Solution code:
def disa_digit(num):
    result = []

    while num > 0:
        result.append(num%10)
        num //= 10
    return result

while True:
    n = int(input())
    if n == 0:
        break
    else:
        print(sum(disa_digit(n)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
	num=str(input())
	a=[]
	ans=0
	if num=='0':
		break
	else:
		for i in num:
			a.append(i)
		b=list(map(int,a))
		for j in range(len(b)):
			ans+=b[j]
		print(ans)

Submission status: Accepted

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

i = 0
while True:
    N=input()
    if N=="0":
        break
    result=sum([int(char) for char in N])
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())
result = []
while (x):
    sum = 0
    sum += x % 10 
    x //= 10
    while (x):
        sum += x % 10
        x //= 10
    result.append(sum)
    x = int(input())

for i in result:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(digitSum)

Submission status: Accepted

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

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

Submission status: Accepted

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

    keta = []
    sum = 0

    for i in number:
        keta.append(i)

    keta2 = list(map(int, keta))

    for i in keta2:
        sum += i

    print(sum)

Submission status: Accepted

Solution code:
L = []
while True:
    A = int(input())
    if A == 0:
        break

    L.append(A)
for i in range(len(L)):
    sum = 0
    for k in range(len(str(L[i]))):
        sum = sum +int(str(L[i])[k])

    print(sum)

Submission status: Accepted

Solution code:
for a in iter(raw_input,'0'):print sum(map(int,str(a)))

Submission status: Accepted

Solution code:
cnt=0
for i in range(10000):
    S=str(input())
    if S=="0":
        break
    else:
        for j in range(len(S)):
            cnt+=int(S[j])
        print(cnt)
        cnt=0

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python

if __name__ == '__main__':
    while True:
        s = raw_input()
        if s == '0':
            break
        print sum(map(int, list(s)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sss = input()
while not sss == '0':
	counter = 0
	num = int(sss)
	while num > 0:
		counter += num % 10
		num //= 10
	print(counter)
	sss = input()

Submission status: Accepted

Solution code:
tmp = []
output = []
for x in range(0,10000):
    tmp = input()
    if tmp == '0':
        break
    else :
        output.append( sum(int(tmp[i]) for i in range(len(tmp))) )
for x in range(len(output)):
    print(output[x])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
while True:
    kazu = [int(x) for x in input()]
    if kazu == 0:
        break
    print('{}'.format(sum(kazu)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
lst=[]
while True:
    lst.append(input())
    if 0 in lst:
        break
for i in lst:
    sum=0
    for j in range(len(i)):
        sum+=i[j]
    print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
while True:
    x = int(input())
    if x == 0:
        break
    table = x.split()
    print(sum(table))

Submission status: Runtime Error

Solution code:
while True:
    x = input()
    if x == 0:
        break
    table = x.split()
    print(sum(table))

Submission status: Runtime Error

Solution code:
while True:
    table = int(input())
    if table[0] == 0:
        break
    print(sum(table))

Submission status: Runtime Error

Solution code:
while True:
    table = input()
    if table[0] == 0:
        break
    print(sum(table))

Submission status: Runtime Error

Solution code:
while True:
    table = str(input())
    if table[0] == 0:
        break
    print(sum(table))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#define MAXSIZE 1000
  
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
  
char init_str[MAXSIZE]={};
  
  
int main()
{
    char str[MAXSIZE];
    int sum;
  
    while(1){
        strcpy(str,init_str);
        scanf("%s",&str);
        if((int)(str[0]-'0')!=0){
            sum=0;
            for(int i=0;(i<MAXSIZE&&(str[i]!='\0'));i++){
                sum += (int)(str[i]-'0');
            }
            cout << sum << endl;
        }
        else break;
    }
    return 0;
}

Submission status: Runtime Error

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