<pre>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Owl {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;
		try {
			while(!((s = br.readLine()).equals(&quot;END&quot;)))
			{
				char[] array = s.toCharArray();
				
				for(int i = array.length - 1; i &gt;= 0; i--)
				{
					if(array[i] != '0')
					{
						int pom = Integer.parseInt(array[i]+&quot;&quot;);
						pom--;
						array[i] = (pom+&quot;&quot;).charAt(0);
						break;
					}
				}
				
				int pom = 0;
				for(int i = 0; i &lt; array.length; i++)
				{
					pom = i;
					if(array[i] != '0')
						break;
				}
				
				String str = new String(array, pom, array.length - (pom));
				/*if(str.length() == 0)
					System.out.println(&quot;0&quot;);
				else*/
					System.out.println(str);
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
</pre>
