第一题
0.9的
#include<iostream>
using namespace std;
bool check(string s1,string s2){
string s3;
int i=0;
while(i<s1.length()&&s1[i]=='0') i++;
for( i;i<s1.length();i++){
s3+=s1[i];
}
s1=s3;
s3.clear();
i=0;
while(i<s2.length()&&s2[i]=='0') i++;
for( i;i<s2.length();i++){
s3+=s2[i];
}
s2=s3;
if(s1.length()>s2.length()) return true;
if(s1.length()<s2.length()) return false;
for(int i=0;i<s1.length();i++){
if(s1[i]>s2[i]) return true;
if(s1[i]<s2[i]) return false;
}
return true;
}
int main(){
string s;
cin>>s;
string s1;
int update=1;
while(update==1){
update=0;
for(int i=0;i<s.length();i++){
if(i+2<s.length()&&s[i]=='R'&&s[i+1]=='E'&&s[i+2]=='D'){
i=i+2;update=1; continue;
}
s1+=s[i];
}
if(update==0) break;
s=s1;
s1.clear();
}
//cout<<s1<<endl;
string s2;
string s3="";
for(int i=0;i<s1.length();i++){
if(s1[i]>='0'&&s1[i]<='9') {
s2+=s1[i];continue;
}
if(s3=="") {
s3=s2;
s2.clear();
continue;}
if(check(s2,s3)){
s3=s2;
}
s2="";
}
if(check(s2,s3)){
s3=s2;
}
if(s3.length()==0) cout<<-1<<endl;
else {
int i=0;
while(s3[i]=='0') i++;
for(i;i<s3.length();i++){
cout<<s3[i];
}
cout<<endl;
}
}