#include #include using namespace std; int main(void) { string a, b; string ao, bo; cin >> a >> b; ao = a; bo = b; if (a.size() < b.size()) { cout << b << endl;; return 0; } else if (a.size() > b.size()) { cout << a << endl;; return 0; } for (int i = 0; i < a.size(); ++i) { if (a[i] == '4' && b[i] == '7') swap(a[i], b[i]); else if (a[i] == '7' && b[i] == '4') swap(a[i], b[i]); } int aa = atoi(a.c_str()); int bb = atoi(b.c_str()); if (aa < bb) { cout << bo << endl; } else { cout << ao << endl; } return 0; }