import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        } true {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        } String num = sc.next(); num sc.next() sc.next sc int i; i int Sum = 0; Sum 0 for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            } i = 0; i = 0 i 0 i <= (num.length() - 1) i (num.length() - 1) num.length() num.length num 1 i++ i++ i {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            } {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            } int x = ((num.charAt(i)) - '0'); x ((num.charAt(i)) - '0') (num.charAt(i)) num.charAt num i '0' Sum += x Sum x if(Sum == 0) break; Sum == 0 Sum 0 break; System.out.printf("%d\n", Sum) System.out.printf System.out System System.out "%d\n" Sum String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true) {
            String num = sc.next();
            int i;
            int Sum = 0;
            for (i = 0; i <= (num.length() - 1); i++) {
                int x = ((num.charAt(i)) - '0');
                Sum += x;
            }
            if(Sum == 0) break;
            System.out.printf("%d\n", Sum);
        }
    }
}

