
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	}
}
  import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	}
} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	} main {
		Scanner scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		} true {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		} String number = scn.nextLine(); number scn.nextLine() scn.nextLine scn if (number.equals("0")) {
				break;
			} number.equals("0") number.equals number "0" {
				break;
			} break; char[] changedData = number.toCharArray(); changedData number.toCharArray() number.toCharArray number int sum = 0; sum 0 for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			} int i = 0; int i = 0; i 0 i < changedData.length i changedData.length changedData changedData.length i++ i++ i {
				sum = sum + Character.getNumericValue(changedData[i]);
			} {
				sum = sum + Character.getNumericValue(changedData[i]);
			} sum = sum + Character.getNumericValue(changedData[i]) sum sum + Character.getNumericValue(changedData[i]) sum Character.getNumericValue(changedData[i]) Character.getNumericValue Character changedData[i] changedData 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 scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		while (true) {
			String number = scn.nextLine();
			if (number.equals("0")) {
				break;
			}
			char[] changedData = number.toCharArray();
			int sum = 0;
			for (int i = 0; i < changedData.length; i++) {
				sum = sum + Character.getNumericValue(changedData[i]);
			}
			System.out.println(sum);
		}
	}
} Main

import java.util.Scanner;

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