import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String test = "0"; test "0" while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        } true {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        } String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc int sum =0; sum 0 if(str.equals(test))break; str.equals(test) str.equals str test break; for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            } int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            } {
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            } sum+=Integer.parseInt(String.valueOf(str.charAt(i))) sum Integer.parseInt(String.valueOf(str.charAt(i))) Integer.parseInt Integer String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i if(sum!=0)System.out.println(sum); sum!=0 sum 0 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){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String test = "0";
        while(true) {
            String str = sc.nextLine();
            int sum =0;
            if(str.equals(test))break;
            for(int i=0;i<str.length();i++){
            	sum+=Integer.parseInt(String.valueOf(str.charAt(i)));
            }
            if(sum!=0)System.out.println(sum);
        }
        sc.close();
    }
}

