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