import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) long sum; sum String input; input while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        } true {
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        } sum = 0 sum 0 input = scanner.nextLine() input scanner.nextLine() scanner.nextLine scanner if(input.equals("0")){
                break;
            } input.equals("0") input.equals input "0" {
                break;
            } break; String[] mash = input.split(""); mash input.split("") input.split input "" for(String txt : mash){
                sum += Integer.parseInt(txt);
            } String txt mash {
                sum += Integer.parseInt(txt);
            } {
                sum += Integer.parseInt(txt);
            } sum += Integer.parseInt(txt) sum Integer.parseInt(txt) Integer.parseInt Integer txt System.out.println(sum) System.out.println System.out System System.out sum scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        long sum;
        String input;
        while (true){
            sum = 0;
            input = scanner.nextLine();

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

            String[] mash = input.split("");

            for(String txt : mash){
                sum += Integer.parseInt(txt);
            }
            System.out.println(sum);
        }
        scanner.close();
    }
}

