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

public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

} Main public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	} BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); buf new BufferedReader(new InputStreamReader(System.in)) StringBuilder output = new StringBuilder(); output new StringBuilder() String line; line int c; c int sum = 0; sum 0 try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			} (line = buf.readLine()) != null (line = buf.readLine()) line buf.readLine() buf.readLine buf null {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			} for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				} int i = 0; int i = 0; i 0 i < line.length() i line.length() line.length line i++ i++ i {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				} {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				} c = Integer.parseInt("" + line.charAt(i)) c Integer.parseInt("" + line.charAt(i)) Integer.parseInt Integer "" + line.charAt(i) "" line.charAt(i) line.charAt line i sum += c sum c if (sum == 0) break; sum == 0 sum 0 break; output.append(sum).append('\n') output.append(sum).append output.append(sum) output.append output sum '\n' sum = 0 sum 0 System.out.print(output) System.out.print System.out System System.out output String[] args args public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

} public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder output = new StringBuilder();
		String line;
		int c;
		int sum = 0;
		try {
			while((line = buf.readLine()) != null) {
				for (int i = 0; i < line.length(); i++) {
					c = Integer.parseInt("" + line.charAt(i));
					sum += c;
				}
				if (sum == 0) break;
				output.append(sum).append('\n');
				sum = 0;
			}
			System.out.print(output);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}