import java.util.*;

public class Main {
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    }
} import java.util.*; util.* java public class Main {
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    }
} Main public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    } main {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    } Scanner scan = new Scanner( System.in ); scan new Scanner( System.in ) while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        } true {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        } char[] charaArray = scan.nextLine().toCharArray(); charaArray scan.nextLine().toCharArray() scan.nextLine().toCharArray scan.nextLine() scan.nextLine scan int result = 0; result 0 for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            } char chara charaArray {
                result += Character.getNumericValue( chara );
                

            } {
                result += Character.getNumericValue( chara );
                

            } result += Character.getNumericValue( chara ) result Character.getNumericValue( chara ) Character.getNumericValue Character chara if (result == 0) break; result == 0 result 0 break; System.out.println(result) System.out.println System.out System System.out result scan.close() scan.close scan String args[] args public class Main {
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    }
} public class Main {
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    }
} Main
import java.util.*;

public class Main {
    public static void main( String args[] ) {
        Scanner scan = new Scanner( System.in );
        
        while ( true ) {
            char[] charaArray = scan.nextLine().toCharArray();
            
            int result = 0;
            for( char chara: charaArray ) {
                result += Character.getNumericValue( chara );
                

            }
            if (result == 0) break;
            System.out.println(result);

        }
        scan.close();
        
    }
}