#include
#include
using namespace std;
int main() {
string a;
cin>> a;
int countNum = 0;
string recordNum = "";
string longestNum = "";
for (int i = 0; i < a.size(); ++i) {
if (isdigit(a[i]) && recordNum == "") {
recordNum += a[i];
}
else if (isdigit(a[i])) {
if (recordNum[recordNum.size() - 1] + 1 == a[i]) {
recordNum += a[i];
}
else {
if (recordNum.size() > longestNum.size()) {
longestNum = recordNum;
}
recordNum = "";
}
}
else {
continue;
}
}
if (recordNum.size() > longestNum.size()) {
longestNum = recordNum;
}
cout << longestNum << endl;
return 0;
}