#include #include using namespace std; bool comp(int a, int b) { if ((a == '4' || a == '7') && (b == '4' || b == '7')) { return a < b; } return a > b; } string comp(const string& a, const string& b) { if (a.size() > b.size()) return a; if (a.size() < b.size()) return b; for (size_t i = 0; i < a.size(); i++) { if (comp(a[i], b[i])) return a; if (comp(b[i], a[i])) return b; } return a; } int main(void) { string a, b; cin >> a >> b; cout << comp(a, b) << endl; }