while True:

    data = eval(input())

    if data[0] == '0':

        break



    print((sum([int(i) for i in data])))
for str in iter(input, "0"):

  print((sum(int(c) for c in str)))
while True:
    data = eval(input())
    if data[0] == "0":
        break
    print((sum([int(i) for i in data])))

for str in iter(input, "0"):
    print((sum(int(c) for c in str)))

-while True: -    data = eval(input()) -    if data[0] == "0": -        break -    print((sum([int(i) for i in data]))) +for str in iter(input, "0"): +    print((sum(int(c) for c in str)))