#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
    
	string s;
	while(cin >> s) {
		if(s!="END") {
			long long i = s.size() - 1;
			while(s[i] == '0') {
				i--;
			}
			s[i]--;
			if(s[0] == '0') {
				cout << 0 << endl;
			}
			else {
			cout << s << endl;
			}
		}
		else {
			break;
		}
	}

}