res = []

while True:

    s = eval(input())

    if s == '0':

        break



    res.append(sum([int(x) for x in s]))



for e in res:

    print(e)
def sum_of_numbers(n):

    '''

    (* int -> int *)

    '''

    res = [int(n) for n in list(str(n))]

    

    return sum(res)



if __name__ == "__main__":

    while True:

        n = eval(input())

        if n == '0':

            break

        print((sum_of_numbers(n)))

res = []
while True:
    s = eval(input())
    if s == "0":
        break
    res.append(sum([int(x) for x in s]))
for e in res:
    print(e)

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


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

-res = [] -while True: -    s = eval(input()) -    if s == "0": -        break -    res.append(sum([int(x) for x in s])) -for e in res: -    print(e) +def sum_of_numbers(n): +    """ +    (* int -> int *) +    """ +    res = [int(n) for n in list(str(n))] +    return sum(res) + + +if __name__ == "__main__": +    while True: +        n = eval(input()) +        if n == "0": +            break +        print((sum_of_numbers(n)))