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:
import sys
def main():
    for x in sys.stdin:
        if x == "0\n":
            break
        else:
            X = list(x)
            total = 0
            for i in range(len(X) - 1):
                total += int(X[i])
            print(total)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
while True:
    n=0
    s=sys.stdin.readline()
    if s=='0\n': break
    for i in range(len(s)-1):
        n+=int(s[i])
    print(n)

Submission status: Accepted

Solution code:
def main():

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

Submission status: Accepted

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

    n = 0
    for c in line:
        n += int(c)
    print(n)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


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

        digit_sum = 0
        while x:
            digit_sum += x % 10
            x //= 10
        print(digit_sum)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
r = []
while True:
    line = input()
    if line == '0':
        break
    r.append(sum([int(s) for s in line]))

for s in r:
    print(s)

Submission status: Accepted

Solution code:
# Belongs to : midandfeed aka asilentvoice
while(1):
	n = str(input())
	
	if n != '0':
		ans = 0
		for x in n:
			ans += int(x)
		print(ans)
	else:
		break

Submission status: Accepted

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

Submission status: Accepted

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

def main():

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=[]
w=1
while(w!=0):
    w=int(input())
    a.append(w)
a.pop()
for i in a:
    s=0
    for j in range(len(str(i))):
       s+=int(str(i)[j])
    print("{0}".format(s))

Submission status: Accepted

Solution code:
def main():
    while True:
        s = input()

        if s == "0":
            break

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''
Input   Output
123     6
55      10
1000    1
0
'''
for str in iter(input, "0"):
 print(sum([int(c) for c in str]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
for a in iter(input,'0'):
 print(sum([int(s)for s in a]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
while True:
    n = int(input())
    if n == 0:
        break
    a.append(n)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    instr = input()

    if instr == '0':
        break

    total = 0
    for s in instr:
        total += int(s)

    print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
result = []
while 1:
    n = int(input())
    if n == 0:
        break
    ans = 0
    for i in range(1,1001):
        ans += n // pow(10,1000-i)
        n = n % pow(10,1000-i)
    result.append(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:

    x = input()

    if x == '0':
        break

    length = len(x)
    tot = 0

    for i in range(length):
        tot += int(x[i:i + 1])
    print(tot)

Submission status: Accepted

Solution code:
# coding:utf-8
while True:
    array = map(int, list(raw_input()))
    if array[0] == 0:
        break
    print sum(array)

Submission status: Accepted

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

Submission status: Accepted

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

    if n == 0:
        break
    else:
        sum = 0

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

        print(sum)

Submission status: Accepted

Solution code:
# coding: UTF-8
num_list = []
while(1):
    num = [map(int,raw_input())]
    if num[0][0] == 0:
        break
    num_list.extend(num)
for i in range(len(num_list)):
    print sum(num_list[i])

Submission status: Accepted

Solution code:
for a in iter(input,'0'):print(sum([int(s)for s in a]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while(True):
    num_in = list(map(int, [i for i in input()]))
    if(num_in[0]==0):
        break
    else:
        print(sum(num_in))

Submission status: Accepted

Solution code:
from sys import stdin
for line in stdin:
    if line == '0\n':
        break
    num = list(map(int, line.strip('\n')))
    print(sum(num))

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:
  x = input().rstrip('\r\n')
  if x == '0':
    break

  sum = 0

  for ii in range(len(x)):
    sum += int(x[ii])
  print(sum)

Submission status: Accepted

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

import sys

while True:
    s = sys.stdin.readline().strip()
    if s == '0':
        break
    total = 0
    for c in s:
        total += int(c)
    print(total)

Submission status: Accepted

Solution code:
while True:
    inp = input()
    if inp == '0':
        break
    ans = 0
    for i in inp:
        ans += int(i)
    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:
number = input()
length = len(number)

while number != "0":
	i = 0
	sum = 0
	while i < length:
		sum += int(number[i])
		i += 1
	print(sum)
	number = input()
	length = len(number)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools


def sum_of_digits(digits):
    """culculate the sum of each digit of 'digits'

    >>> sum_of_digits("123")
    6
    >>> sum_of_digits("100")
    1
    >>> sum_of_digits("")
    0
    """
    return functools.reduce(lambda x, y: x+int(y), digits, 0)


def run():
    d = input()

    while d != '0':
        print(sum_of_digits(d))
        d = input()


if __name__ == '__main__':
    run()

Submission status: Accepted

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

    numList = list(map(int, list(val)))
    sum = 0
    for i in range(len(numList)):
        sum += int(numList[i])

    print(sum)

Submission status: Accepted

Solution code:
ans = ''
while True:
    s = int(input())
    if s == 0:
        break
    else:
        x = 0
        while s != 0:
            x += s % 10
            s = s // 10
        ans += str(x) + '\n'
if ans != '':
    print(ans[:-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

l = []
for i in sys.stdin:
    l.append(i)

for i in range(0,len(l)):
    if int(l[i]) == 0:
        break
    count = 0
    for j in range(0,len(l[i])-1):
        count += int(l[i][j])
    print(count)

Submission status: Accepted

Solution code:
X = []
while True:
    x = raw_input()
    if x == "0":
        break
    else:
        X.append(x)

ans = []
for i in range(len(X)):
    tmp = 0
    for j in range(len(X[i])):
        tmp+=int(X[i][j])
    ans.append(tmp)

for char in ans:
    print char

Submission status: Accepted

Solution code:
result = []

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

    result.append(sum(list(map(int, str(first_input)))))

print(*result, sep='\n')

Submission status: Accepted

Solution code:
X = []
while(True):
    x = input()
    if x =="0":
        break
    else:
        X.append(x)
for i in range(len(X)):
    x_sum = 0
    for j in X[i]:
        x_sum += int(j)
    print(x_sum)

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:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = str(input())
while x != '0':
    num2 = list(map(int, list(x)))
    print(sum(num2))
    x = str(input())

Submission status: Accepted

Solution code:
line = ""

while line != "0":
	line = input()
	x = 0
	for i in range(len(line)):
		x += int(line[i])
	if x != 0:
		print(x)

Submission status: Accepted

Solution code:
#! python3
# sum_of_numbers.py

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

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

Submission status: Accepted

Solution code:
for a in iter(input,'0'):print(sum(int(s)for s in a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def SoN(x):
	ans = 0
	while 1:
		if x<10:
			ans += x
			return ans
		else:
			ans += x % 10
			x //= 10

while 1:
	x = int(input())
	if x==0:
		break
	print(SoN(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Ans=[]
while True:
    l=list(input())
    if l==["0"]:
        break
    else:
        su=0
        for s in l:
            su+=int(s)
        Ans.append(su)
for a in Ans:
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    sum_digit = 0
    for c in n:
        sum_digit += int(c)

    print(sum_digit)

Submission status: Accepted

Solution code:
# AOJ ITP1_8_B

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        n = int(input())
        if n == 0: break
        sum = 0
        while n > 0:
            sum += n % 10
            n = n // 10
        print(sum)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


for line in sys.stdin :
    if int(line.strip()) == 0 :
        break
    s = line.strip()
    sum = 0
    for c in s :
        sum += int(c)
    print(sum)

Submission status: Accepted

Solution code:
# Sum of Numbers

end = 0
while end == 0:
    number = list(input())
    if number == ["0"]:
        end += 1
    else:
        # print(number)
        digitTotal = 0
        for digit in number:
            digitTotal += int(digit)
        print(digitTotal)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    input_num = input()
    while input_num != "0":
        sum_of_digits = 0
        for d in input_num:
            sum_of_digits = sum_of_digits + int(d)
        print(sum_of_digits)
        input_num = input()

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:
    a=list(input())
    if a[0]=='0':
        break
    g=0
    for i in a:
        g+=int(i)
    print(g)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    if int(line) == 0: break
    s = 0
    for c in line.strip('\n'):
        s += '0123456789'.index(c)
    print s

Submission status: Accepted

Solution code:
while True:
    x = raw_input()
    if x == '0':break
    print sum(['0123456789'.index(c) for c in x])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
        T=raw_input()
        if T=="0":
                break
        t=list(T)
        s=0
        for i in range(len(t)):
                s+=int(t[i])
        print s

Submission status: Accepted

Solution code:
from __future__ import division, print_function
from sys import stdin
for line in stdin:
    if line.startswith('0'):
        break
    print(sum(int(c) for c in line.rstrip()))

Submission status: Accepted

Solution code:
while True:
    n=list((raw_input()))
#    n=list(int(raw_input()))
    if int(n[0]) == 0:
        break
    else:
        x=0
        for i in xrange(len(n)):
            x+=int(n[i])
    print x

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    numbers = [i for i in raw_input()]
    if numbers[0] == '0': break
    print sum(map(int,numbers))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    n = raw_input()
    if n == '0': break;
    print reduce(lambda x,y: x+int(y), n, 0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    x = raw_input()
    if x == '0': break;
    print sum(int(s) for s in x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data=[]
while True:
    string=input()
    if string=='0':
        break
    hen=(list(string))
    data.append(sum([int(s) for s in hen]))


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

Submission status: Accepted

Solution code:
sum=0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=[]
while True:
    tmp=input()
    if tmp=="0":
        break
    else:
        s.append([int(x) for x in list(tmp)])

for i in range(len(s)):
    cnt=0
    for j in range(len(s[i])):
        cnt+=s[i][j]
    print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
  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
    list = [int(i) for i in x]
    print(sum(list))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
answer_lst=[]
while True:
    initial_value=0
    x=int(input())
    if x==0:
        break
    string=str(x)
    for i in string:
        initial_value+=int(i)
    answer_lst.append(initial_value)
for ans in answer_lst:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 :

    
    try :
        a=int(input())
        if a==0:
            break
        else:
            n = sum(list(map(int, str(a))))
            print(n)
        
    except EOFError:
        pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum=0
list=[]
sum_list=[]
while True:
    n=int(input())
    if n!=0:
        list.append(n)
    else:
        break
for i in list:
    i=str(i)
    for j in range(len(i)):
        sum+=int(i[j])
    sum_list.append(sum)
    sum=0

for i in sum_list:
    print(i)

Submission status: Accepted

Solution code:
while 1:
    S = input()
    if S == '0':
        break
    else:
        ans = 0
        for s in S:
            ans += int(s)
        print(ans)

Submission status: Accepted

Solution code:
ans=[]
while_count=0
while True:
    n=input()
    if int(n[0])==0:
        break
    count=0
    for i in range(len(n)):
        count+=int(n[i])
    ans.append(count)
    n=[]
    while_count+=1

for i in range(while_count):
    print(ans[i])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = []
while True:
  e = input()
  if e=='0':
    break
  s = 0
  for i in range(0, len(e)):
    s += int(e[i])
  l.append(s)

print('\n'.join(map(str,l)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#55数字の和
while True:
    n=int(input())
    if n==0:
        break
    a=sum(list(map(int, str(n))))
    print(a)

Submission status: Accepted

Solution code:

while 1:
    
    S = input()
    if( S == "0"):
        break        
    S_int = [int(s) for s in S]
    print( sum(S_int) )

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
xretu = []
xtasi = []

while True:
  retu = int(input())
  if retu == 0:
    break
  xretu.append(retu)
#print(xretu)
for a in xretu:
  xtasi.append(str(a))
#print(xtasi)
for b in xtasi:
  kei = 0
  bnaga = len(b)
  for c in range(bnaga):
    kei += int(b[c])
  print(kei)

Submission status: Accepted

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

    for i in range(len(S)):
        ans += int(S[i])
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 8a
#

def main():
    while True:
        x = input()
        if x == "0":
            break
        r = 0
        for i in range(len(x)):
            r += int(x[i])
        print(r)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
    a = input()
    if a == '0':
        break
    print(sum(list(map(int, list(a)))))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 8_B

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