#define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; int main(){ string A, B; cin >> A >> B; int a = (int)A.size(), b = (int)B.size(); if(a != b){ if(a > b) cout << A << endl; else cout << B << endl; }else{ for(int i = 0; i < a; i++){ if(A[i] == B[i]) continue; if(A[i] > B[i]){ if(A[i] == '7' and B[i] == '4') cout << B << endl; else cout << A << endl; return 0; }else{ if(A[i] == '4' and B[i] == '7') cout << A << endl; else cout << B << endl; return 0; } } } }