
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util public class Main {
    public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    }
} Main public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    } main {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    } try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.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 {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } String number; number ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            } true {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            } number = reader.readLine() number reader.readLine() reader.readLine reader if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                } number.equals("0") number.equals number "0" {
                    break;
                } break; {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                } int sum= 0; sum 0 int count = 0; count 0 for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } int i = 0 ; int i = 0 ; i 0 i < number.length() i number.length() number.length number i++ i++ i {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } count = Character.getNumericValue(number.charAt(i)) count Character.getNumericValue(number.charAt(i)) Character.getNumericValue Character number.charAt(i) number.charAt number i sum += count sum count if (sum != 0) {
                        list.add(sum);
                    } sum != 0 sum 0 {
                        list.add(sum);
                    } list.add(sum) list.add list sum for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            } int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
                System.out.println(list.get(i));
            } {
                System.out.println(list.get(i));
            } System.out.println(list.get(i)) System.out.println System.out System System.out list.get(i) list.get list i String[] args args public class Main {
    public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    }
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        try {
            String number;
            ArrayList<Integer> list = new ArrayList<>();
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            while (true) {
                number = reader.readLine();
                
                if ( number.equals("0")) {
                    break;
                } else {
                    int sum= 0;
                    int count = 0;
                    for (int i = 0 ; i < number.length() ; i++ ) {
                        count = Character.getNumericValue(number.charAt(i));
                        sum += count;
                    } 
                    if (sum != 0) {
                        list.add(sum);
                    }
                }
            }
            for (int i = 0; i < list.size();i++) {
                System.out.println(list.get(i));
            }
        } catch ( IOException e) {
            System.out.println(e);
        }
    }
}