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

Submission status: Accepted

Solution code:
import sys
import itertools
import math

# import numpy as np

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
answer = []

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    if i == '0':
        break

    ans = 0

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

    print(str(ans))

Submission status: Accepted

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

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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#結果の格納リストの準備
result = list()

#インプットdataの読み込みと計算
while True:
    input_data = list(input())
    input_data_int = [int(d) for d in input_data]
    if input_data_int[0] == 0:
        break
    result.append(sum(input_data_int))

#結果の表示
[print(i) for i in result]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
queue=[]

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
def sum_of_numbers(num):

    s = 0

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

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

if __name__ == "__main__":
    

    while(True):

        number = input()

        if int(number) == 0:
            break 

        sum_of_numbers(number)

Submission status: Accepted

Solution code:
while True:

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

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

    print(s)

Submission status: Accepted

Solution code:
while True:
    n = int(input()) #数値の入力
    if n == 0: #０だった時終了
        break
    l = [int(i) for i in list(str(n))] #入力した数値を各桁ずつリストに入れる
    print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

    print(r)

Submission status: Accepted

Solution code:
import sys

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

def main():
    #h0,w0h1,w1 = map(int, input().split())
    s=input()
    while s!="0":
        print(sum(int(c) for c in s))
        s=input()

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
result = []

while True:
    n = input()

    if n == '0':
        break

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

    result.append(tmp)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

for i in Z:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
x = input()
while(x != '0'):
    
    sum = 0
    for _ in x[:]:
        sum+=int(_)
    print(sum)
    x = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x=input()
    if x=='0':
        break
    sum=0
    for c in list(x):
        sum+=int(c)
#        print(f"c={int(c)},sum={sum}")
    print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = []

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

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

for v in sums:
    print(v)

Submission status: Accepted

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

    print(sum(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def test():

	while True:

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

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

if __name__ == "__main__":
	test()

Submission status: Accepted

Solution code:
#coding: utf-8

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    print(sum)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    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:
        print(x)
    else:
        break

Submission status: Accepted

Solution code:
import sys,os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())
n = list(map(int, n))
while(not n==[0]):
  print(sum(n))
  n=list(input())
  n = list(map(int, n))

Submission status: Accepted

Solution code:
while True:
	ans=0
	s=input()
	if s=='0':
		break
	for x in s:
		ans += ord(x) - 48
	print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
while 1:
  n = input()
  if n == '0':
    break
  print(sum(int(x) for x in 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:
n = 0
while True:
    n=int(input())
    if n==0:
        break
    print(sum([int(e) for e in list(str(n))]))

Submission status: Accepted

Solution code:
while True:
    x = input()

    if x == '0':
        break

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

    print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

while True:
   line = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    x = input()
    if x == '0': break
      
    print(sum(int(c) for c in 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:
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
while True:
    table = str(input())
    if(table[0] == '0'):
        break
    print(sum(int(num) for num in(table)))

Submission status: Accepted

Solution code:
# coding: utf-8

while True:
    line = input()

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

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

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

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

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

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

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

mymath = mymath()

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

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

ansl = []

while True:

    x = input()

    if x == "0":
        break

    now = 0
    for i in x:

        now += int(i)


    ansl.append(now)


for i in ansl:

    print (i)

Submission status: Accepted

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

    print(sum)

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