#include 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] == b[i]) continue; else if(a[i] == '4' and b[i] == '7'){ cout << a << endl; return 0; } else if(a[i] == '7' and b[i] == '4'){ cout << b << endl; return 0; } else{ cout << (a[i] > b[i] ? a : b) << endl; return 0; } } } return 0; }