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[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(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[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true) {
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);

        while(true) {
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while(true) {
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        } true {
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        } String num = sc.next(); num sc.next() sc.next sc int[] x; x x = new int[1000] x new int[1000] 1000 int length = num.length(); length num.length() num.length num int sum = 0; sum 0 for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0'; int i = 0; int i = 0; i 0 i < length i length i++ i++ i x[i] = num.charAt(i) - '0'; x[i] = num.charAt(i) - '0' x[i] x i num.charAt(i) - '0' num.charAt(i) num.charAt num i '0' for (int i = 0; i < length; i++)
                sum += x[i]; int i = 0; int i = 0; i 0 i < length i length i++ i++ i sum += x[i]; sum += x[i] sum x[i] x i if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            } sum == 0 sum 0 {
                break;
            } break; {
                System.out.println(sum);
            } System.out.println(sum) System.out.println System.out System System.out 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[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true) {
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(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[] x;
            x = new int[1000];
            int length = num.length();
            int sum = 0;

            for (int i = 0; i < length; i++)
                x[i] = num.charAt(i) - '0';

            for (int i = 0; i < length; i++)
                sum += x[i];

            if (sum == 0) {
                break;
            } else {
                System.out.println(sum);
            }
        }
    }
}

