import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    } main {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        } int i = 0; int i = 0; i 0 i < 1 i 1 i = 0 i = 0 i 0 {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        } {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        } String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] l = line.split(""); l line.split("") line.split line "" int len = l.length; len l.length l l.length int ans = 0; ans 0 for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          } int j = 0; int j = 0; j 0 j < len j len j++ j++ j {
            ans += Integer.parseInt(l[j]);
          } {
            ans += Integer.parseInt(l[j]);
          } ans += Integer.parseInt(l[j]) ans Integer.parseInt(l[j]) Integer.parseInt Integer l[j] l j if(ans == 0) {
            break;
          } ans == 0 ans 0 {
            break;
          } break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        for(int i = 0; i < 1; i = 0) {
          String line = sc.nextLine();
          String[] l = line.split("");

          int len = l.length;
          int ans = 0;
          for(int j = 0; j < len; j++) {
            ans += Integer.parseInt(l[j]);
          }

          if(ans == 0) {
            break;
          }

          System.out.println(ans);
        }
    }
}