import java.io.*;

public class Main {

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	}
} import java.io.*; io.* java public class Main {

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	}
} Main public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] str = new String[1000]; str new String[1000] 1000 int sum = 0; sum 0 while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		} true {
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		} str = br.readLine().split("") str br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			} int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
				sum += Integer.parseInt(str[i]);
			} {
				sum += Integer.parseInt(str[i]);
			} sum += Integer.parseInt(str[i]) sum Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i if(sum==0)	break; sum==0 sum 0 break; System.out.println(sum) System.out.println System.out System System.out sum sum = 0 sum 0 String[] args args public class Main {

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	}
} public class Main {

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	}
} Main
import java.io.*;

public class Main {

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[1000];
		int sum = 0;
		while(true)
		{
			str = br.readLine().split("");
			for(int i=0; i<str.length; i++)
			{
				sum += Integer.parseInt(str[i]);
			}
			if(sum==0)	break;
			System.out.println(sum);
			sum = 0;
		}
	}
}