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: Wrong Answer

Solution code:
print(*[sum(map(int, line.strip())) for line in open(0).readlines()][:-1], sep='\n')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=input()
result = sum(list(map(int, str(n))))
print(result)

Submission status: Wrong Answer

Solution code:
a = int(input())
alist = []

if a/1000 >=1:
    alist.append(int(a/1000))
if (a-int(a/1000)*1000) / 100 >= 1:
    alist.append(int((a-int(a/1000)*1000) / 100))
if (a-int(a/100)) / 10 >= 1:
    alist.append(int((a-(int(a/100)*100)) / 10))
alist.append(a-(int(a/10)*10))
a2 = 0
for i in alist:
    a2 += i
    print(i)
print(a2)

Submission status: Wrong Answer

Solution code:
a = int(input())
alist = []

if a/1000 >=1:
    alist.append(int(a/1000))
if (a-int(a/1000)*1000) / 100 >= 1:
    alist.append(int((a-int(a/1000)*1000) / 100))
if (a-int(a/100)) / 10 >= 1:
    alist.append(int((a-(int(a/100)*100)) / 10))
alist.append(a-(int(a/10)*10))
a2 = 0
for i in alist:
    a2 += i
print(a2)

Submission status: Wrong Answer

Solution code:
go = 1
while go == 1:
    a = int(input())
    alist = []
    if a ==0:
        go = 0
        exit
    if a/1000 >=1:
        alist.append(int(a/1000))
    if (a-int(a/1000)*1000) / 100 >= 1:
        alist.append(int((a-int(a/1000)*1000) / 100))
    if (a-int(a/100)) / 10 >= 1:
        alist.append(int((a-(int(a/100)*100)) / 10))
    alist.append(a-(int(a/10)*10))
    a2 = 0
    for i in alist:
        a2 += i
    if go == 1:
        print(a2)

Submission status: Wrong Answer

Solution code:
go = 1
while go == 1:
    a = str(input())
    alist = list(a)
    print("alist[0] =", alist[0])
    if a == "0":
        go = 0
        exit
    sum = 0
    for i in alist:
        i = int(i)
        sum += i
    if go == 1:
        print(sum)

Submission status: Wrong Answer

Solution code:
while True:
  x=int(input())
  if x == 0 : break
  
  a=x//1000
  b=(x-a*1000)//100
  c=(x-a*1000-b*100)//10
  d=x-a*1000-b*100-c*10
  print(a+b+c+d)

Submission status: Wrong Answer

Solution code:
print sum(map(int,list(raw_input())))

Submission status: Wrong Answer

Solution code:
x = map(int,list(raw_input()))
if 0 != x[0]:
    print sum(x)

Submission status: Wrong Answer

Solution code:
import sys
from functools import reduce
for line in sys.stdin:
    if line == "0":
        break
    s = reduce(lambda a,b: str(a)+str(b), line.strip())
    print(s)

Submission status: Wrong Answer

Solution code:
import sys
from functools import reduce
for line in sys.stdin:
    if line == "0":
        break
    s = reduce(lambda a,b: int(a)+int(b), line.strip())
    print(s)

Submission status: Wrong Answer

Solution code:
import math

while True:  

  x = int(input())  

  if x == 0 :
    break

  else :
    sum = 0
    n=math.floor(math.log(x,10))
    sum = math.floor(x/math.pow(10,n))
    for i in reversed(range(n+1)):
      sum = sum + math.floor((x%math.pow

(10,i))/math.pow(10,i-1))

  print(sum)

Submission status: Wrong Answer

Solution code:
while True:
    n = raw_input()
    if n=="0":
        break
    ans = 0
    for x in xrange(len(n)-1):
        ans += int(n[x])
    print ans

Submission status: Wrong Answer

Solution code:
while True:
    a=str(raw_input())
    if a=="0": break
    sum([int(i) for i in a])

Submission status: Wrong Answer

Solution code:
while True:
    num = input()

    print sum(map(int,list(str(num))))
    if num == 0:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
answer =[]
while True:
    date = int(input())
    if date == 0:
        break
    a = date//1000
    b = date//100
    c = date//10
    answer.append(a+(b-a*10)+(c-b*10)+(date-c*10))
for j in range(len(answer)):
    print(answer[j])

Submission status: Wrong Answer

Solution code:
answer =[]
while True:
    date = int(input())
    if date == 0:
        break
    a = date//1000
    b = date//100
    c = date//10
    answer.append(a+(b-a*10)+(c-b*10)+(date-c*10))
for j in range(len(answer)):
    print('{0}'.format(answer[j]))

Submission status: Wrong Answer

Solution code:
n = int(input())
tarou = 0
hanako = 0
for x in range(n):
    if hanako > tarou:
        hanako += 3
    elif tarou > hanako:
        tarou += 3
    else:
        tarou += 1
        hanako += 1
print("{0} {1}".format(tarou, hanako))

Submission status: Wrong Answer

Solution code:
num = int(input())
while num != 0:
    tho = num//1000
    hun = (num%1000)//100
    ten = (num%100)//10
    one = num%10
    print(tho+hun+ten+one)
    num = int(input())

Submission status: Wrong Answer

Solution code:
number = input()
number2 = []
for i in range(len(number)):
    number2.append(number[i])

number2 = map(int, number2)
answer = sum(number2)

print(answer)

Submission status: Wrong Answer

Solution code:
n = list(input().lower())
charac = []
for j in range(97,97+26):
    m= 0
    for i in range(0,len(n)):
        if ord(n[i]) == j:
            m += 1
        charac.append("{} : {}".format(chr(j),m))

for i in range(0,26):
    print(charac[i])

Submission status: Wrong Answer

Solution code:
a = list(input())
b = [int(a) for a in a]
print(sum(b))

Submission status: Wrong Answer

Solution code:
while True:

    value = [int(x) for x in raw_input().split()]
    if value[0] == 0:
        break
    print(sum(value))

Submission status: Wrong Answer

Solution code:
print(sum([int(i) for i in input()]))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        print(sum([int(i) for i in input()]))
    except:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

array = []
x,y = [],[]
for i in sys.stdin:
    if int(i) == 0:
        break
    array.append(i)

for i in range(len(array)):
    n = int(array[i])
    a = n // 1000
    n = n % 1000
    b = n // 100
    n = n % 100
    c = n // 10
    n = n % 10
    d = n
    print(a+b+c+d)

Submission status: Wrong Answer

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

array = []
x,y = [],[]
for i in sys.stdin:
    if int(i) == 0:
        break
    array.append(i)

for i in range(len(array)):
    n = int(array[i])
    num = []

    while int(n) != 0:
        num.append(n % 10)
        n /= 10
        n = int(n)
    sum = 0
    for i in range(len(num)):
        sum  += num[i]  
    print(sum)

Submission status: Wrong Answer

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

array = []
for i in sys.stdin:
    if int(i) == 0:
        break
    array.append(i)

for i in range(len(array)):
    n = int(array[i])
    num = []

    if n > 10000000:
        a = n // 10000000
        b = n % 10000000
        while int(a) != 0:
            num.append(int(a) % 10)
            a /= 10
        while int(b) != 0:
            num.append(int(b) % 10)
            b /= 10
            
        sum = 0
        for i in range(len(num)):
            sum += int(num[i])
        print(sum)

    else:
        while int(n) != 0:
            num.append(int(n) % 10)
            n /= 10
            sum = 0
            for i in range(len(num)):
                sum  += int(num[i])
            print(sum)

Submission status: Wrong Answer

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

array = []
for i in sys.stdin:
    if int(i) == 0:
        break
    array.append(i)

for i in range(len(array)):
    n = int(array[i])
    num = []
    a,b = 0,0
    if n > 10000000:
        a = n // 10000000
        b = n % 10000000
        while int(a) != 0:
            num.append(int(a) % 10)
            a /= 10
        while int(b) != 0:
            num.append(int(b) % 10)
            b /= 10
            
        sum = 0
        for i in range(len(num)):
            sum += int(num[i])
        print(sum)

    else:
        while int(n) != 0:
            num.append(int(n) % 10)
            n /= 10
            sum = 0
            for i in range(len(num)):
                sum  += int(num[i])
        print(sum)

Submission status: Wrong Answer

Solution code:
n = input()
while n != "0":
    ans = 0
    for i in range(len(n)):
        print(ord(n[i:i+1]))
        ans += ord(n[i:i+1]) - 48

    print(ans)
    n = input()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
word = input()
result = 0
for i in word:
    result += int(i)
print(result)

Submission status: Wrong Answer

Solution code:
data = []
while True:
    x = int(input().strip())
    if x == 0:
        break
    data.append(x)

for i in range(len(data)):
    thou = data[i] // 1000
    hund = (data[i] - thou * 1000) // 100
    ten = (data[i] - (thou * 1000 + hund * 100)) // 10
    one = (data[i] - (thou * 1000 + hund * 100 + ten * 10)) // 1
    print(thou + hund + ten + one)

Submission status: Wrong Answer

Solution code:
while True:
    count = 0
    num = [int(i) for i in input().split(" ")]
    if num[0] == 0:
        break
    for n in num:
        count += n
    print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(''.join(c.upper() if c.islower() else c.lower() if c.isupper() else c for c in input()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while 1:
    m = int(input())
    n = []
    while 1:
        n.append(m % 10)
        if int(m/10)==0:
            break
        else:
            m = int(m / 10)
    if sum(n) == 0:
        break
    else:
        print(sum(n))

Submission status: Wrong Answer

Solution code:
x = 1
L=[]
n= 0
while x is not 0:
    x = int(input())
    L.append(x)

L.remove(0)
for i in L:
    while i >=1:
        n +=i%10
        i= int(i/10)

    print (n)
    n=0

Submission status: Wrong Answer

Solution code:
x = 1
L=[]
n= 0
s=0
while x is not 0:
    x = int(input())
    L.append(x)
N=1
L.remove(0)
for i in L:
    while i >N:

        N=10*N
        n =i%N
        s+=(n/N*10)
        i-=n
    print (int(s))
    n=0

Submission status: Wrong Answer

Solution code:
x = 1
L=[]
n= 0
s=0
while x is not 0:
    x = int(input())
    L.append(x)
N=1
L.remove(0)
for i in L:
    while i >N:

        N=10*N
        n =i%N
        s+=(n/N*10)
        i-=n
    print (int(s))
    s=0
    N = 1

Submission status: Wrong Answer

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

sum(list1)

Submission status: Wrong Answer

Solution code:
list1 = []
result = 0
while True:
    x = str(input())
    if x == '0':
        break
    else:
        for i in x:
            result += int(i)
        list1.append(result)
            
for i in list1:
    print(i)

Submission status: Wrong Answer

Solution code:
a=0

while True:
    z=str(input())
    for i in z:
        k=int(i)
        a+=k
    print(a)
    a=0
    if z == '0' :  
        break

Submission status: Wrong Answer

Solution code:
def main():

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

Submission status: Wrong Answer

Solution code:
result = []
while 1:
    n = int(input())
    if n == 0:
        break
    digit4 = n // 1000
    n = n % 1000
    digit3 = n // 100
    n = n % 100
    digit2 = n // 10
    n = n % 10

    result.append(n + digit2 + digit3 + digit4)

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

Submission status: Wrong Answer

Solution code:
N = input()
ans = 0
for i in range(len(N)) :
    k = int(N[i])
    ans = ans + k
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i = int(input())
sum = 0

while i != 0:
	sum += i
	i = int(input())

print(sum)

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

Solution code:
while True:
    x=int(input())
    if x==0:
        break
    i=x%10
    j=(x-i)%100/10
    k=(x-j*10-i)%1000/100
    print(int(i+j+k))

Submission status: Wrong Answer

Solution code:
from math import floor
while True:
    x=int(input())
    if x==0:
        break
    i=floor(x/1000)
    j=floor((x-i*1000)/100)
    k=floor((x-i*1000-j*100)/10)
    l=x%10
    print(int(i+j+k+l))

Submission status: Wrong Answer

Solution code:
n=input()
s=list(n)
a=[int(i) for i in s]
print(sum(a))

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
reduce(lambda x,y: x+int(y), raw_input(), 0)

Submission status: Accepted

Solution code:
def main():

    while True:
        num = input()
        if num == '0':
            break
        else:
            count = 0
            for s in num:
                count += int(s)
            print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
while True:
    string = input().strip()
    if string == '0':   break
    print(sum([int(c) for c in string]))

Submission status: Accepted

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

        if num == "0":
            break

        print(sum([int(x) for x in num]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    kazu = [int(x) for x in input()]
    if kazu == [0]:
        break
    else:
        print('{}'.format(sum(kazu)))

Submission status: Accepted

Solution code:
x = input()
while x != '0':
    x_nums = sum([int(i) for i in x[:]])
    print(x_nums)
    x = input()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
values = []
while True:
    value = input()
    if value == "0":
        break
    else:
        values.append(value)

for value in values:
    summation = 0
    for i in range(len(value)):
        summation += int(value[i])
    print(summation)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
readline = open(0).readline
write = open(1, 'w').write
while 1:
    x = readline()
    if x == "0\n":
        break
    write("%d\n" % sum(map(int, x.strip())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    
    num = int(input())
    
    if num == 0:
        break
    box = []
    while num != 0:
        box.append(num%10)
        num = num//10
        
    print(sum(box))

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 = int(input())
    if x == 0:
        break
    SCORE = len(str(x))
    ans = 0
    amari=x
    for i in range(SCORE+1):
        ans += amari//10**(SCORE-i)
        amari = amari%10**(SCORE-i)
    print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

while True:
    x = [int(i) for i in list(stdin.readline().rstrip())]
    if len(x) == 1 and x[0] == 0:
        break
    else:
        print(sum(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:

	num = input()
	if num == "0":
		break
	else:
		k = 0
		for j in num:
			k += int(j)
		print(k)

Submission status: Accepted

Solution code:
table = []
i = 0
while True:
  table.append(int(input()))
  if table[i] == 0:
    break
  i += 1

for num in table:
  if num == 0:
    break
  sum = 0
  i = 0
  while num != 0: 
    sum += num % 10
    num //= 10
    if num == 0:
      break
  print(sum)

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

while True:
    buf = list(input())
    if len(buf) == 1 and int(buf[0]) == 0:
        break
    else:
        ans = 0
        for i in range(len(buf)):
            ans += int(buf[i])
        print(ans)

Submission status: Accepted

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

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 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 == 0:
    break
  print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
go = 1
while go == 1:
    a = str(input())
    alist = list(a)
    if a == "0":
        go = 0
        exit
    sum = 0
    for i in alist:
        i = int(i)
        sum += i
    if go == 1:
        print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    d = raw_input()
    s = 0
    if int(d) == 0:
        break
    for c in d:
        v = ord(c) - ord('0')
        s = s + v
    print s

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list()
while True:
    a.append(sum(list(map(lambda x: int(x), list(input())))))
    if a[-1] == 0:
        break
for a_ in a[:-1]:
    print(a_)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while 1:
    n,a=raw_input(),0
    for i in n:a+=int(i)
    if a:print a
    else:break

Submission status: Accepted

Solution code:
s = raw_input()
while s != "0":
	sum = int(s[0])
	for i in range(1,len(s)):
		sum += int(s[i])
	print sum
	s = raw_input()

Submission status: Accepted

Solution code:
while True:
    x = map(int,list(raw_input()))
    if 0 != x[0]:
        print sum(x)
    else:
        break

Submission status: Accepted

Solution code:
while True:
    numlist = raw_input()
    
    if numlist[0]=="0":
        break

    s = 0
    for num in numlist:
        s+=int(num)

    print s

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sum = [] 

while True:
    text = input()

    if text == '0':
        break

    tmp = 0
    for i in range(len(text)):
       tmp += int(text[i]) 
    sum.append(tmp)

for r in sum:
    print(r)

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

    total = 0
    for a in range(len(text)):
        total += int(text[a])

    print(total)

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:
import sys
from functools import reduce
for line in sys.stdin:
    if int(line) == 0:
        break
    s = reduce(lambda a,b: int(a)+int(b), line.strip())
    print(s)

Submission status: Accepted

Solution code:
while True:
    try:
        x = raw_input()
        if x == '0':
            break
    except EOFError:
        break
    
    tot = 0
    for s in x:
        tot += int(s)
    print tot

Submission status: Accepted

Solution code:
def solve(x):
    return sum([int(i) for i in str(x)])

if __name__ == '__main__':
    while True:
        x = int(input())
        if x == 0: break
        print(solve(x))

Submission status: Accepted

Solution code:
#coding:utf-8
#1_8_B 2015.4.7
while True:
    number = input()
    if number == '0':
        break
    print(sum(int(i) for i in number))

Submission status: Accepted

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

Submission status: Accepted

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

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Submission status: Accepted

Solution code:
import sys

while True:
	line = sys.stdin.readline().rstrip()
	t = sum( [ int( line[i] ) for i in range( len( line ) ) ] )
	if 0 == t:
		break
	else:
		print( t )

Submission status: Accepted

Solution code:
import sys

while True:
	line = sys.stdin.readline().rstrip()
	t = sum( [ int( line[i] ) for i in range( len( line ) ) ] )
	if 0 == t:
		break
	else:
		print( t )

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    s = raw_input()
    if s == "0":
        break
    sum = 0
    for i in xrange(len(s)):
        sum += int(s[i:i+1])

    print sum

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
data = []
while True:
    in_line = raw_input()
    if int(in_line) == 0:
        break
    sum = 0
    for s in in_line:
        sum += int(s)
    data.append(sum)
for d in data:
    print d

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    n = raw_input()
    if n=="0":
        break
    ans = 0
    for x in xrange(len(n)):
        ans += int(n[x])
    print ans

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys

ans = []
while ( 1 ):
    
    strings = input()
    if (len(strings) == 1 and int(strings[0]) == 0):
        break
    
    ans = 0
    for s in strings:
        ans += int(s)
    print(ans)

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().strip()
    if x == '0':
        break
    print(sum(int(c) for c in x))

Submission status: Accepted

Solution code:
num = []
ans = []
while True:
    num = map(int,raw_input())
    if num == list([0]):
        break
    ans.append(sum(num))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
	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:
for str in iter(input, "0"):
  print(sum(int(c) for c in str))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_list=[]
while True:
    num = input()
    if num == 0:
        break
    num_list.append(num)

for num in num_list:
    print sum(map(int,list(str(num))))

Submission status: Accepted

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

while True:
    n = int(raw_input())
    if n == 0:
        break
    else:
        sum = 0
        while n > 0:
            sum += n%10
            n /= 10
        print sum