RT,WA on test 10
#include<bits/stdc++.h>
using namespace std;
string s;
int k,pos,mx=-INT_MAX,nw;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>s;
int n=s.size();
for(int i(0);i<n;i++){
if(s[i]=='1'){
k=i;
break;
}
}
if(k==n-1){
cout<<s;
return 0;
}
for(int i(k+1);i<n;i++){
if(s[i]=='0')
++nw;
if(s[i]=='1'){
if(nw>mx){
pos=i-1;
mx=nw;
nw=0;
}
}
if(i==n-1){
if(s[i]=='1'){
if(nw>mx){
pos=i-1;
mx=nw;
nw=0;
}
}
else{
if(nw>mx){
pos=i;
mx=nw;
nw=0;
}
}
}
}
for(int i(0);i<k;i++)
cout<<s[i];
for(int i(pos);i>=k;i--)
cout<<s[i];
for(int i(pos+1);i<n;i++)
cout<<s[i];
return 0;
}