#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
  while ( cin >> s && s != "END" ) {
	bool change = false;
	for ( size_t t = s.size() - 1; t >= 0; t-- )
	{
		if ( s[ t ] != '0' ) {
			change = true;
			s[ t ] -= 1; break;
		}
	}
	
	if ( !change || s[ 0 ] == '0' ) {
		cout << "0" << endl;
	} else {
		cout << s << endl;
	}
  }
  
  
  
  return 0;
}