import java.util.Scanner;

public class Main{ 
        public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        }
    } import java.util.Scanner; Scanner java.util public class Main{ 
        public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        }
    } Main public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        } main {
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        } int i=0 i 0 j=0 j 0 count=0 count 0 d d sum=0 sum 0 s=0; s 0 String a; a char c; c int b[]; b b = new int[100000] b new int[100000] 100000 Scanner n = new Scanner(System.in); n new Scanner(System.in) while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                } true {
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                } a = n.nextLine() a n.nextLine() n.nextLine n sum = 0 sum 0 for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     } i=0; i=0 i 0 i<a.length() i a.length() a.length a i++ i++ i {
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     } {
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     } c = a.charAt(i) c a.charAt(i) a.charAt a i d = Character.getNumericValue(c) d Character.getNumericValue(c) Character.getNumericValue Character c if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         } d==0 && (a.length())==1 d==0 d 0 (a.length())==1 (a.length()) a.length a 1 {
                             s=1;
                             break;
                         } s=1 s 1 break; sum = sum + d sum sum + d sum d if(s==1){
                         break;
                     } s==1 s 1 {
                         break;
                     } break; b[j] = sum b[j] b j sum count++ count j++ j i=0 i 0 while(count>i){
                     System.out.println(b[i]);
                     i++;
                } count>i count i {
                     System.out.println(b[i]);
                     i++;
                } System.out.println(b[i]) System.out.println System.out System System.out b[i] b i i++ i String[] args args public class Main{ 
        public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        }
    } public class Main{ 
        public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        }
    } Main
import java.util.Scanner;

public class Main{ 
        public static void main(String[] args){
            int i=0,j=0,count=0,d,sum=0,s=0;
            String a;
            char c;
            int b[];
            b = new int[100000];
                Scanner n = new Scanner(System.in);
                while(true){
                     a = n.nextLine();
                     sum = 0;
                     for(i=0;i<a.length();i++){
                         c = a.charAt(i);
                         d = Character.getNumericValue(c);
                         if(d==0 && (a.length())==1){
                             s=1;
                             break;
                         }
                         sum = sum + d;
                     }
                     if(s==1){
                         break;
                     }
                     b[j] = sum; 
                     count++;
                     j++;
                }
                i=0;
                while(count>i){
                     System.out.println(b[i]);
                     i++;
                }
        }
    }
