import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

                if (sum == 0) {
                    break outer;
                }
            }
            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);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

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

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

                if (sum == 0) {
                    break outer;
                }
            }
            System.out.println(sum);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

                if (sum == 0) {
                    break outer;
                }
            }
            System.out.println(sum);
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

                if (sum == 0) {
                    break outer;
                }
            }
            System.out.println(sum);
        }
    }
} Main
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        outer:
        while (true) {

            String line = sc.next();

            int t;
            int sum = 0;

            for (int i = 0; i < line.length(); i++) {

                t = line.charAt(i) - '0';
                sum += t;

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

