#include<stdio.h>
#include<string.h>
char str[1001];
int maxs,maxe;
int magcomp(int x,int y){
while(str[x]=='0'){
x++;
}
while(str[maxs]=='0'){
maxs++;
}
if((y-x)==(maxe-maxs)){
while(maxs<=maxe && x<=y){
if(str[x]>str[maxs]){
return 1;
}
maxs++;
x++;
}
}
else if((y-x)>(maxe-maxs)){
return 1;
}
else{
return 0;
}
return 0;
}
int main(){
int i,len;
int prev,current,next;
scanf("%s",str);
len=strlen(str);
i=0;
while(str[i]=='0'){
i++;
}
prev=i;
int flag;
if(str[prev]>='A' && str[prev]<='Z'){
str[prev]='9';
i++;
}
while(i<len && str[i]>='0' && str[i]<='9'){
i++;
}
current=i;
maxs=prev;
maxe=current-1;
if(current<len){
str[current]='9';
i++;
while(i<len && str[i]>='0' && str[i]<='9'){
i++;
}
if(i<len){
next=i;
while(1){
str[current]='9';
flag=magcomp(prev+1,next-1);
if(flag){
maxs=prev+1;
maxe=next-1;
}
prev=current;
current=next;
i=next+1;
while(i< len && str[i]>='0' && str[i]<='9'){
i++;
}
if(i==len){
break;
}
next=i;
}
}
else{
next=i;
flag=magcomp(prev+1,next-1);
if(flag){
maxs=prev+1;
maxe=next-1;
}
}
}
flag=0;
while(maxs<=maxe){
if(!flag && str[maxs]=='0'){
}
else{
flag=1;
printf("%c",str[maxs]);
}
maxs++;
}
printf("\n");
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RyaW5nLmg+CmNoYXIgc3RyWzEwMDFdOwppbnQgbWF4cyxtYXhlOwppbnQgbWFnY29tcChpbnQgeCxpbnQgeSl7CiAgICB3aGlsZShzdHJbeF09PScwJyl7CgkJeCsrOwoJfQoJd2hpbGUoc3RyW21heHNdPT0nMCcpewoJCW1heHMrKzsKCX0KCWlmKCh5LXgpPT0obWF4ZS1tYXhzKSl7CgkJd2hpbGUobWF4czw9bWF4ZSAmJiB4PD15KXsKCQkJaWYoc3RyW3hdPnN0clttYXhzXSl7CgkJCQlyZXR1cm4gM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