import java.io.*;
import java.util.*;
 
public class Main{
 
    public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
 
    public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    }
} Main public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    } main {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    } ArrayList<Integer> intAry = new ArrayList<Integer>(); intAry new ArrayList<Integer>() int intAnswer = 0; intAnswer 0 try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        } catch (IOException e) {
            System.out.println(e);
        } IOException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in)); insBR new BufferedReader(new InputStreamReader(System.in)) while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            } true {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            } String strLine = insBR.readLine(); strLine insBR.readLine() insBR.readLine insBR if(strLine.equals("0")) {
                    break;
                } strLine.equals("0") strLine.equals strLine "0" {
                    break;
                } break; char[] chaAryLine = strLine.toCharArray(); chaAryLine strLine.toCharArray() strLine.toCharArray strLine for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                } int i = 0; int i = 0; i 0 i < chaAryLine.length i chaAryLine.length chaAryLine chaAryLine.length i++ i++ i {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                } {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                } int intNum = Integer.parseInt("" + chaAryLine[i]); intNum Integer.parseInt("" + chaAryLine[i]) Integer.parseInt Integer "" + chaAryLine[i] "" chaAryLine[i] chaAryLine i intAnswer += intNum intAnswer intNum intAry.add(intAnswer) intAry.add intAry intAnswer intAnswer = 0 intAnswer 0 int intSize = intAry.size(); intSize intAry.size() intAry.size intAry for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            } int i = 0; int i = 0; i 0 i < intSize i intSize i++ i++ i {
                System.out.println(intAry.get(i));
            } {
                System.out.println(intAry.get(i));
            } System.out.println(intAry.get(i)) System.out.println System.out System System.out intAry.get(i) intAry.get intAry i String[] args args public class Main{
 
    public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    }
} public class Main{
 
    public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    }
} Main
import java.io.*;
import java.util.*;
 
public class Main{
 
    public static void main(String[] args) {

        ArrayList<Integer> intAry = new ArrayList<Integer>();
 
        int intAnswer = 0;

        try {
            BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
 
            while(true) {
                String strLine = insBR.readLine();

                if(strLine.equals("0")) {
                    break;
                }
 

                char[] chaAryLine = strLine.toCharArray();
 
                for(int i = 0; i < chaAryLine.length; i++) {
                    int intNum = Integer.parseInt("" + chaAryLine[i]);
 
                    intAnswer += intNum;
                }
                intAry.add(intAnswer);

                intAnswer = 0;
 
            }
            int intSize = intAry.size();

            for(int i = 0; i < intSize; i++) {
                System.out.println(intAry.get(i));
            }
 
        } catch (IOException e) {
            System.out.println(e);
        }
 
    }
}