#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdlib>
#include <cstring>
#include <sstream>

#define REP(i, n) for(int i=0;i<(n);++i)
#define REPE(i, n) for(int i=0;i<=(n);++i) 
#define REPA(i, a, b) for(int i=(a);i<(b);++i)
#define REPAE(i, a, b) for(int i=(a);i<=(b);++i) 

using namespace std;

typedef unsigned long long int ULINT;
typedef long long int LINT;
typedef pair<int,int> PPI;

int main() {

	for(;;) {
		string str;
		cin >> str;
		if(str == "END") break;
		for(int i = str.size() - 1; i>=0; --i)
			if(str[i]!='0') {
				str[i]--;
				break;
			}
		int ind = 0;
		while(ind < str.size() && str[ind] == '0')
			ind++;
			
		string tmp = str.substr(ind);
		if(tmp.size() == 0) tmp = "0";
		cout << tmp << endl;
	}


	return 0;
}