#include <iostream>
#include <regex>
#include <stack>
#include <vector>
using namespace std;
void delNum(string n) {
int k = n.length() - 5;
stack<int> digits;
for (long i = 0; i < n.length(); i++) {
int tmp = n[i] - 0;
if (digits.empty()) digits.push(tmp);
else {
while (!digits.empty() && tmp > digits.top() && k > 0) {
digits.pop();
k--;
}
digits.push(tmp);
}
}
while (k > 0 && !digits.empty()) {
digits.pop();
k--;
}
vector<char> chars;
while (!digits.empty()) {
int tmp = digits.top();
digits.pop();
chars.push_back(tmp);
}
for (long i = chars.size() - 1; i >= 0; i--) cout << chars[i];
}
int main() {
string s;
cin >> s;
string n = regex_replace(s, regex(R"([\D])"), "");
delNum(n);
return 0;
}