khanhduy26052008
Giới thiệu
include <bits/stdc++.h>
using namespace std;
define int long long
define task "str"
const int M = 1e9 + 7;
void file() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
}
bool cmp(string a, string b) {
return a.size() < b.size();
}
signed main(){
//file();
string s; cin >> s;
map<char, int> mp;
vector<string> v, v1;
string cnt = "";
for (int i = 0; i < s.size(); i++){
if (islower(s[i])) mp[s[i]]++;
if (isdigit(s[i])) {
cnt += s[i];
v.push_back(cnt);
}
else cnt = "";
}
if (cnt != "") v.push_back(cnt);
for (int i = 0; i < v.size(); i++) {
reverse(v[i].begin(), v[i].end());
for (int j = v[i].size() - 1; j >= 1; j--) {
if (v[i][j] == '0') v[i].pop_back();
else break;
}
reverse(v[i].begin(), v[i].end());
}
sort(v.begin(), v.end(), cmp);
int res = v[v.size() - 1].size();
for (int i = 0; i < v.size(); i++) if (v[i].size() == res) v1.push_back(v[i]);
sort(v1.begin(), v1.end());
cout <<v1[v1.size() - 1];
return 0;
}