import java.util.Scanner;

public class Main {

    public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    }

} Main public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    } main {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        } !sc.hasNext("0") sc.hasNext("0") sc.hasNext sc "0" {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        } int sum = 0; sum 0 String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc char[] ch = line.toCharArray(); ch line.toCharArray() line.toCharArray line for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            } int i = 0; int i = 0; i 0 i < ch.length i ch.length ch ch.length i++ i++ i {
                sum += Integer.parseInt("" + ch[i]); 
            } {
                sum += Integer.parseInt("" + ch[i]); 
            } sum += Integer.parseInt("" + ch[i]) sum Integer.parseInt("" + ch[i]) Integer.parseInt Integer "" + ch[i] "" ch[i] ch i System.out.println(sum) System.out.println System.out System System.out sum sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    }

} public class Main {

    public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args)throws Exception {

        Scanner sc = new Scanner(System.in);

        while (!sc.hasNext("0")) {
            int sum = 0;
            String line = sc.nextLine();
            char[] ch = line.toCharArray();
            for (int i = 0; i < ch.length; i++) {
                sum += Integer.parseInt("" + ch[i]); 
            }
            System.out.println(sum);
            
        }
        sc.close();
    }

}