import java.util.Scanner;

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

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String numbers = "1";
    int sum;

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  }
} Main public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String numbers = "1";
    int sum;

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    String numbers = "1";
    int sum;

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String numbers = "1"; numbers "1" int sum; sum while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    } true {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    } numbers = scanner.nextLine() numbers scanner.nextLine() scanner.nextLine scanner if (numbers.equals("0")) break; numbers.equals("0") numbers.equals numbers "0" break; sum = 0 sum 0 for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      } int i = 0; int i = 0; i 0 i < numbers.length() i numbers.length() numbers.length numbers ++i ++i i {
        sum += Character.getNumericValue(numbers.charAt(i));
      } {
        sum += Character.getNumericValue(numbers.charAt(i));
      } sum += Character.getNumericValue(numbers.charAt(i)) sum Character.getNumericValue(numbers.charAt(i)) Character.getNumericValue Character numbers.charAt(i) numbers.charAt numbers i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String numbers = "1";
    int sum;

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String numbers = "1";
    int sum;

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  }
} Main
import java.util.Scanner;

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

    while(true) {
      numbers = scanner.nextLine();
      if (numbers.equals("0")) break;
      
      sum = 0;
      for (int i = 0; i < numbers.length(); ++i) {
        sum += Character.getNumericValue(numbers.charAt(i));
      }
      System.out.println(sum);
    }
  }
}
