import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
} Main public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	} main {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	} String line = null; line null int num = 0; num 0 Scanner sc = null; sc null try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		} {
			sc.close();
		} sc.close() sc.close sc {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} sc = new Scanner(System.in) sc new Scanner(System.in) do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0")); !line.equals("0") line.equals("0") line.equals line "0" {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} line = sc.nextLine() line sc.nextLine() sc.nextLine sc char[] work = line.toCharArray(); work line.toCharArray() line.toCharArray line for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					} int i = 0; int i = 0; i 0 i < work.length i work.length work work.length i++ i++ i {
						num += Character.getNumericValue(work[i]);
					} {
						num += Character.getNumericValue(work[i]);
					} num += Character.getNumericValue(work[i]) num Character.getNumericValue(work[i]) Character.getNumericValue Character work[i] work i if (num != 0) {

						System.out.println(num);
					} num != 0 num 0 {

						System.out.println(num);
					} System.out.println(num) System.out.println System.out System System.out num num = 0 num 0 String[] args args public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
} public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String line = null;
		int num = 0;

		Scanner sc = null;
		try {

			sc = new Scanner(System.in);

			do {
				line = sc.nextLine();

					//????????????1?????????????´?
					char[] work = line.toCharArray();

					//??°????????????
					for (int i = 0; i < work.length; i++) {
						num += Character.getNumericValue(work[i]);
					}
					if (num != 0) {

						System.out.println(num);
					}

					//?????????
					num = 0;

			} while (!line.equals("0"));
		} finally {
			sc.close();
		}
	}
}