import java.util.HashMap;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.Collections;
import java.math.BigDecimal;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    }
} import java.util.HashMap; HashMap java.util import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex import java.util.Collections; Collections java.util import java.math.BigDecimal; BigDecimal java.math public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    }
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    } main {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        } sc.hasNext() sc.hasNext sc {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        } String s = sc.next(); s sc.next() sc.next sc BigDecimal b = new BigDecimal(s); b new BigDecimal(s) if (b.compareTo(new BigDecimal(0)) == 0) break; b.compareTo(new BigDecimal(0)) == 0 b.compareTo(new BigDecimal(0)) b.compareTo b new BigDecimal(0) 0 break; int sum = 0; sum 0 for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                sum += Character.getNumericValue(s.charAt(i));
            } {
                sum += Character.getNumericValue(s.charAt(i));
            } sum += Character.getNumericValue(s.charAt(i)) sum Character.getNumericValue(s.charAt(i)) Character.getNumericValue Character s.charAt(i) s.charAt s i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    }
} public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    }
} Main
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.Collections;
import java.math.BigDecimal;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String s = sc.next();
            BigDecimal b = new BigDecimal(s);
            
            if (b.compareTo(new BigDecimal(0)) == 0) break;
            
            int sum = 0;
            for (int i = 0; i < s.length(); i++) {
                sum += Character.getNumericValue(s.charAt(i));
            }
            System.out.println(sum);
        }
    }
}