#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <climits>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

vector<string> split(string haystack, string needle) {
    vector<string> result;
    int startPos = 0;
    int foundPos = haystack.find(needle, startPos);
    while (foundPos != string::npos) {
        int count = foundPos - startPos;
        string token = haystack.substr(startPos, count);
        if (!token.empty()) {
            result.push_back(token);
        }
        startPos = foundPos + needle.length();
        foundPos = haystack.find(needle, startPos);
    }
    string token = haystack.substr(startPos, haystack.length() - startPos);
    if (!token.empty()) {
        result.push_back(token);
    }
    return result;
}

string nameConvert(const string& name) {
    const string DELIMITER = " ";
    stringstream builder;
    auto parts = split(name, DELIMITER);
    for (auto part : parts) {
        part[0] = toupper(part[0]);
        transform(part.begin() + 1, part.end(), part.begin() + 1, ::tolower);
        builder << part << DELIMITER;
    }
    return builder.str();
}

string dateConvert(const string& date) {
    const string DELIMITER = "/";
    stringstream builder;
    auto parts = split(date, DELIMITER);
    builder << setw(2) << setfill('0') << parts[0] << DELIMITER;
    builder << setw(2) << setfill('0') << parts[1] << DELIMITER;
    builder << parts[2];
    return builder.str();
}

string maxValue(int m, int s) {
    string result = "";
    while (m--) {
        if (s > 9) {
            result = result + '9';
            s = s - 9;
        }
        else {
            result = result + to_string(s);
            s = 0;
        }
    }
    return result;
}
string minValue(int m, int s) {
    string result = "";
    s--;
    while (m--) {
        if (s > 9) {
            result = result + '9';
            s = s - 9;
        }
        else {
            result = to_string(s) + result;
            s = 0;
        }
    }
    result[0]++;
    return result;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    string s;cin >> s;
    
    for (int i = 0;i < s.length();i++) {
        if (!isdigit(s[i])) {
            s[i] = ' ';
        }
    }
    auto parts = split(s, " ");
    vector<string> v;
    for (auto part : parts) {
        while (part[0] == '0') {
            part.erase(0, 1);
        }
        if (part.size() != 0) {
            v.push_back(part);
        }
    }

    sort(v.begin(), v.end(), [](string a, string b) {
        if (a.length() != b.length()) {
            return a.length() < b.length();
        }
        return a < b;
    });

    if (v.size() == 0) {
        cout << 0;
    }
    else {
        cout << *(v.rbegin());
    }
    return 0;
}

