#include using namespace std; int main() { string a, b; cin >> a >> b; if (a.size() > b.size()) { cout << a << endl; } else if (b.size() > a.size()) { cout << b << endl; } else { for (int i = 0; i < a.size(); ++i) { if (a[i] == '4' && b[i] == '7') { cout << a << endl; goto end; } else if (b[i] == '4' && a[i] == '7') { cout << b << endl; goto end; } else if (a[i] > b[i]) { cout << a << endl; goto end; } else if (b[i] > a[i]) { cout << b << endl; goto end; } } cout << a << endl; } end:; }