#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
string in;
getline(cin, in);
char bits[in.size() + 1];
strcpy(bits, in.c_str());
int first = in.find('1');
int last = in.rfind('1');
vector<string> waves;
for(int i = first; i <= last; i++)
{
if(i + 1 < in.size() && bits[i] == '0' && bits[i + 1] == '0')
{
waves.push_back(in.substr(first - 1, i - first + 2));
while(bits[i] == '0')
{
i++;
}
first = i;
}
}
waves.push_back(in.substr(first - 1, last - first + 3));
vector<string> res;
for(string wave : waves)
{
int n0 = 0;
int n1 = 0;
for(char c : wave)
{
if(c == '0')
{
n0++;
}
else
{
n1++;
}
}
if(n0 - n1 == 1)
{
res.push_back(wave);
}
}
sort(res.begin(), res.end(), [](const string& w1, const string& w2)
{
return w1.length() > w2.length();
});
if(!res.empty())
{
cout << res[0] << endl;
}
else
{
cout << -1 << endl;
}
return 0;
}