#include using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; 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] == b[i]) continue; if (a[i] == '4' && b[i] == '7') {cout << a << endl; return 0;} if (a[i] == '7' && b[i] == '4') {cout << b << endl; return 0;} cout << max(a, b) << endl; return 0; } cout << a << endl; } return 0; }