
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    }

} Main public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    } main {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    } Scanner sc; sc String line; line int p; p int b; b char a; a sc = new Scanner(System.in) sc new Scanner(System.in) String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    }

} public class Main {
    public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    }

} Main

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc;
        String line;
        int p;
        int b;
        char a;
        sc = new Scanner(System.in);
        outer:
        while (true) {

        line = sc.next();
        p = line.length();
        b=0;

            for (int i = 0; i < p; i++) {
                a = line.charAt(i);
                if (p == 1 && a == 48) {
                    break outer;
                }
                b = b + (a - 48);
            }
            System.out.println(b);
        }
    }

}
