import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	}
} Main public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	} main {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc int b = a.length(); b a.length() a.length a char c ; c int g = 0; g 0 int e = 0 ; e 0 int f = 1; f 1 if (b==1){
				f = Integer.parseInt(a);
			} b==1 b 1 {
				f = Integer.parseInt(a);
			} f = Integer.parseInt(a) f Integer.parseInt(a) Integer.parseInt Integer a while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			} f != 0 f 0 {
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			} for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				} int d=0 ; int d=0 ; d 0 d<b d b d++ d++ d {
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				} {
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				} c = a.charAt(d) c a.charAt(d) a.charAt a d g = Character.getNumericValue(c) g Character.getNumericValue(c) Character.getNumericValue Character c e += g e g System.out.println(e) System.out.println System.out System System.out e a = sc.next() a sc.next() sc.next sc b = a.length() b a.length() a.length a if (b==1){
					f = Integer.parseInt(a);
				} b==1 b 1 {
					f = Integer.parseInt(a);
				} f = Integer.parseInt(a) f Integer.parseInt(a) Integer.parseInt Integer a e = 0 e 0 String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	}
} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			int b = a.length();
			char c ;
			int g = 0;
			int e = 0 ;
			int f = 1;
			if (b==1){
				f = Integer.parseInt(a);
			}
			while(f != 0){
				for(int d=0 ; d<b ; d++){
					c = a.charAt(d);
					g = Character.getNumericValue(c);
					e += g;
				}
				System.out.println(e);
				a = sc.next();
				b = a.length();
				if (b==1){
					f = Integer.parseInt(a);
				}
				e = 0;
			}
	}
}