import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
} Main public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int x; x String inputed; inputed ArrayList<String> inputs = new ArrayList<String>(); inputs new ArrayList<String>() while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    } true {
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    } try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	} IOException e {
	    		e.printStackTrace();
	    	} e.printStackTrace() e.printStackTrace e {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} inputed = br.readLine() inputed br.readLine() br.readLine br if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		} Character.getNumericValue(inputed.charAt(0)) == 0 Character.getNumericValue(inputed.charAt(0)) Character.getNumericValue Character inputed.charAt(0) inputed.charAt inputed 0 0 {
	    			break;
	    		} break; inputs.add(inputed) inputs.add inputs inputed for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		} int i = 0; int i = 0; i 0 i < inputs.size() i inputs.size() inputs.size inputs i++ i++ i {
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		} {
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		} x = 0 x 0 for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			} int j = 0; int j = 0; j 0 j < inputs.get(i).length() j inputs.get(i).length() inputs.get(i).length inputs.get(i) inputs.get inputs i j++ j++ j {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			} {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			} x += Character.getNumericValue(inputs.get(i).charAt(j)) x Character.getNumericValue(inputs.get(i).charAt(j)) Character.getNumericValue Character inputs.get(i).charAt(j) inputs.get(i).charAt inputs.get(i) inputs.get inputs i j System.out.printf("%d\n",x) System.out.printf System.out System System.out "%d\n" x String[] args args public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int x;
	    String inputed;
	    ArrayList<String> inputs = new ArrayList<String>();

	    while(true){
	    	try {
	    		inputed = br.readLine();
	    		if(Character.getNumericValue(inputed.charAt(0)) == 0) {
	    			break;
	    		}
	    		inputs.add(inputed);
	    	} catch (IOException e) {
	    		e.printStackTrace();
	    	}
	    }
		for(int i = 0; i < inputs.size(); i++){
			x = 0;
			for(int j = 0; j < inputs.get(i).length(); j++) {
				x += Character.getNumericValue(inputs.get(i).charAt(j));
			}
			System.out.printf("%d\n",x);
		}
	}
}

