import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	} main {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		} true {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		} String[] lines =  sc.nextLine().split(""); lines sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" int sum = 0; sum 0 for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			} int i = 0; int i = 0; i 0 i < lines.length i lines.length lines lines.length i++ i++ i {
				sum += Integer.parseInt(lines[i]);
			} {
				sum += Integer.parseInt(lines[i]);
			} sum += Integer.parseInt(lines[i]) sum Integer.parseInt(lines[i]) Integer.parseInt Integer lines[i] lines i if(sum == 0) {
				break;
			} sum == 0 sum 0 {
				break;
			} break; 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 sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (true) {
			String[] lines =  sc.nextLine().split("");
			int sum = 0;
			for(int i = 0;i < lines.length;i++) {
				sum += Integer.parseInt(lines[i]);
			}
			if(sum == 0) {
				break;
			}
			System.out.println(sum);
		}
	}
}