#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] > b[i] || (a[i] == '4' && b[i] == '7')) { cout << a << endl; goto end; } if (b[i] > a[i] || (b[i] == '4' || a[i] == '7')) { cout << b << endl; goto end; } } cout << a << endl; } end:; }